Skip to content
Related Articles

Related Articles

Improve Article

How to put author/title name over image in ReactJS?

  • Last Updated : 06 Sep, 2021
Geek Week

We can place the author or title name over the image using the GridListTileBar Component in ReactJS. This component adds an overlay over the child component. Material UI for React has this component available for us and it is very easy to integrate. We can use the GridListTileBar component in ReactJS using the following approach.

Creating React Application And Installing Module:

Step 1: Create a React application using the following command:

npx create-react-app foldername

Step 2: After creating your project folder i.e. foldername, move to it using the following command:

cd foldername

Step 3: After creating the ReactJS application, Install the material-ui modules using the following command:

npm install @material-ui/core
npm install @material-ui/icons

Project Structure: It will look like the following.

Project Structure

Filename-App.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.


import React from 'react';
import GridList from '@material-ui/core/GridList';
import GridListTile from '@material-ui/core/GridListTile';
import GridListTileBar from '@material-ui/core/GridListTileBar';
import ListSubheader from '@material-ui/core/ListSubheader';
import IconButton from '@material-ui/core/IconButton';
import InfoIcon from '@material-ui/icons/Info';
const App = () => {
  return (
    <div style={{ width: 700, margin: 'auto' }}>
      <h3>How to put title over image in ReactJS?</h3>
      <GridList cellHeight={180} >
        <GridListTile key="Subheader" cols={2} rows={4} style={{ height: 'auto' }}>
          <ListSubheader component="div">December</ListSubheader>
            title='Computer Science Portal'
            subtitle={<span>by: GeeksforGeeks</span>}
              <IconButton aria-label={`Best Place to learn`}>
                <InfoIcon />
export default App;


Step to Run Application: Run the application using the following command from the root directory of the project:


npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:



Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :