React js UI example. Show Hide Columns using bootstrap table

React js UI example and template, Show Hide Columns using bootstrap table! . 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!

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>
			<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="container">
    <div class="row">
        <div class="col-md-12">
<div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>#</th>
                        <th id="click-me">Click Me</th>
                        <th>Last Name</th>
                        <th>Username</th>
                        <th class="toggleDisplay">Th 1</th>
                        <th class="toggleDisplay">Th 2</th>
                        <th class="toggleDisplay">Th 3</th>
                        <th class="toggleDisplay">Th 4</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <th scope="row">1</th>
                        <td>Mark</td>
                        <td>Otto</td>
                        <td>@mdo</td>
                        <td class="toggleDisplay">Td 1</td>
                        <td class="toggleDisplay">Td 2</td>
                        <td class="toggleDisplay">Td 3</td>
                        <td class="toggleDisplay">Td 4</td>
                    </tr>
                    <tr>
                        <th scope="row">2</th>
                        <td>Jacob</td>
                        <td>Thornton</td>
                        <td>@fat</td>
                        <td class="toggleDisplay">Td 1</td>
                        <td class="toggleDisplay">Td 2</td>
                        <td class="toggleDisplay">Td 3</td>
                        <td class="toggleDisplay">Td 4</td>
                    </tr>
                    <tr>
                        <th scope="row">3</th>
                        <td>Larry</td>
                        <td>the Bird</td>
                        <td>@twitter</td>
                        <td class="toggleDisplay">Td 1</td>
                        <td class="toggleDisplay">Td 2</td>
                        <td class="toggleDisplay">Td 3</td>
                        <td class="toggleDisplay">Td 4</td>
                    </tr>
                </tbody>
            </table>
        </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;}

.toggleDisplay {
  display: none;
}
.toggleDisplay.in {
  display: table-cell;
}

Similar snippets

React js template and ui example bs4 project list

bs4 project list

React js template and ui example news widget

news widget

React js template and ui example team members list

team members list

React js template and ui example timeline steps

timeline steps

React js template and ui example bs5 dark footer

bs5 dark footer

React js template and ui example shopping cart with selected products order summary and checkout button

shopping cart with selected products order summary and checkout button

React js template and ui example profile followers with search input

profile followers with search input

React js template and ui example Clients testimonial with small photo

Clients testimonial with small photo