React js UI example. News Widget

React js UI example and template, News Widget! . Take a look at this UI example and see how it can enhance your project. Your can copy or download the code and use it in your project. Don't forget to browse our library of other free React Native templates for even more design and functionality inspiration. Happy coding!
Tags: news blog,widget

1. First, we need fresh reactjs setup, and for that, we need to run below commands into out terminal, and also we should have latest node version installed on our system:

npx create-react-app my-awesome-project

cd my-awesome-project

npm start

2. Now we need to run below commands into our project terminal to get bootstrap and related modules into our reactjs application:

npm install [email protected] --save

npm start //For start project again

3. Finally for the main output, we need to add below code into our my-awesome-project/src/App.js file or if you have fresh setup then you can replace my-awesome-project/src/App.js file code with below code:

import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';


function App() {
  
	return (
		<div>
			<div class="container">
<div class="row">
    <div class="col-md-6 news-item">
        <img src="https://www.bootdey.com/image/400x400/" alt="news"/>
        <div class="decor-info descr">
          <h5 class="m-b-md"><a href="#/">Name of the article in one row</a></h5>
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni dolore alias doloremque, impedit enim tenetur, esse mollitia repellendus nemo, rem recusandae quisquam quam.</p>
          <a class="readmore" href="#/">Read more</a>
        </div>
    </div>
    <div class="col-md-6 news-item">
        <img src="https://www.bootdey.com/image/400x400/" alt="news"/>
        <div class="decor-danger descr">
          <h5 class="m-b-md"><a href="#/">Name of the article in one row</a></h5>
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni dolore alias doloremque, impedit enim tenetur, esse mollitia repellendus nemo, rem recusandae quisquam quam.</p>
          <a class="readmore" href="#/">Read more</a>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-6 news-item">
        <img src="https://www.bootdey.com/image/400x400/" alt="news"/>
        <div class="decor-primary descr">
          <h5 class="m-b-md"><a href="#/">Name of the article in one row</a></h5>
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni dolore alias doloremque, impedit enim tenetur, esse mollitia repellendus nemo, rem recusandae quisquam quam.</p>
          <a class="readmore" href="#/">Read more</a>
        </div>
    </div>
    <div class="col-md-6 news-item">
        <img src="https://www.bootdey.com/image/400x400/" alt="news"/>
        <div class="decor-info descr">
          <h5 class="m-b-md"><a href="#/">Name of the article in one row</a></h5>
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni dolore alias doloremque, impedit enim tenetur, esse mollitia repellendus nemo, rem recusandae quisquam quam.</p>
          <a class="readmore" href="#/">Read more</a>
        </div>
    </div>
</div>
</div>
		</div>
	);
}
export default App;

4. Now we need to add below code into our my-awesome-project/src/App.css file :


body{margin-top:20px;}
.news-item img {
    width: 100%;
    max-height: 250px;
    height: 250px;
    overflow: hidden;
    object-fit: cover;
}

.news-item .descr {
    padding: 30px;
    color: #fff;
    text-align: center;
    height: 250px;
}

.decor-success {
    background-color: #46be8a !important;
}

.decor-info {
    background-color: #39bee8 !important;
}

.decor-primary {
    background-color: #7266ba !important;
}

.decor-warning {
    background-color: #f2a654 !important;
}

.decor-danger {
    background-color: #ff69b4 !important;
}

.decor-primary-hue {
    background-color: #585b9c !important;
}

.news-item .descr h5 a {
    color: #fff;
    text-decoration: none;
}

.m-b-md, .news-item {
    margin-bottom: 30px !important;
}

.news-item .descr a.readmore:hover {
    text-decoration: none;
}
.news-item .descr a.readmore {
    display: inline-block;
    border: 1px solid #fff;
    border-radius: 30px;
    color: #fff;
    font-size: 24px;
    padding: 8px 22px;
}

Similar snippets

React js template and ui example social blog post widget with commets

social blog post widget with commets

React js template and ui example Blog Gallery Widget

Blog Gallery Widget

React js template and ui example bs4 timeline widget

bs4 timeline widget

React js template and ui example profile tab widget

profile tab widget

React js template and ui example bs5 dark footer

bs5 dark footer

React js template and ui example chat app

chat app

React js template and ui example contacts list table

contacts list table

React js template and ui example profile edit data and skills

profile edit data and skills