Pop Over & ToolTip

You can add the component on any page in the template. You need to follow the steps given below:

Step 1: You need to create a state and function to handle it's event. Also you need to add the code of popover in the page where you want to add the component. Please check the code snippet given below, we have added the popover in the Ecommerce Dashboard:

/**
 * Ecommerce Dashboard
 */

import React, { Component } from 'react'
...

export default class EcommerceDashboard extends Component {
	// Popover State
	state = {
		popoverOpen: false
	};

	// Popover Function
	toggle() {
		this.setState({
		  popoverOpen: !this.state.popoverOpen
		});
	}
	
	render() {
		const { match } = this.props;
		return (
			...
						// Popover Code
						<div>
							<Button id="Popover1" type="button" color="primary">
								Open Popover
							</Button>
							<Popover placement="bottom" isOpen={this.state.popoverOpen} target="Popover1" toggle={() => this.toggle()}>
								<PopoverHeader>Popover Title</PopoverHeader>
								<PopoverBody>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</PopoverBody>
							</Popover>
						</div>
					</div>

Step 2: Now Import the component from its parent library.

import { Button, Popover, PopoverHeader, PopoverBody } from 'reactstrap';

We have given you an example of adding a simple popover on the Ecommerce Dashboard.

You can check some other layouts of popover below. For adding any of the below layout in the template, please check their relative code in the src->routes->components->popover->components folder.

Last updated