Toolbar
A container for grouping a set of controls, like buttons, toggles or menus.
- Beta
Buy Pro
- 0.40.0 (latest)
Import#
Toolbar
: The container component.ToolbarButton
: Either a regular or icon button.ToolbarGroup
: Component for grouping buttons.ToolbarToggleGroup
: A set of toggle buttons with on/off state.ToolbarToggleButton
: A button that can be toggled on or off.ToolbarDivider
: A divider component.
import {Toolbar,ToolbarButton,ToolbarGroup,ToolbarToggleGroup,ToolbarToggleButton,} from '@saas-ui-pro/react'
Usage#
The Toolbar can be used in combination with the Page
component or standalone in other parts of your app that requires a group of controls or actions.
Basic#
import { Spacer } from '@chakra-ui/react'import { FiAlignLeft, FiAlignCenter, FiAlignRight } from 'react-icons/fi'import { FiBold, FiItalic, FiUnderline, FiLink } from 'react-icons/fi'import {Toolbar,ToolbarButton,ToolbarDivider,ToolbarToggleGroup,ToolbarToggleButton,} from '@saas-ui-pro/react'export default function BasicToolbar() {return (<Toolbar><ToolbarToggleGroupspacing="1"defaultValue="left"onChange={console.log}><ToolbarToggleButtonicon={<FiAlignLeft />}label="Align left"value="left"/><ToolbarToggleButtonicon={<FiAlignCenter />}label="Align center"value="center"/><ToolbarToggleButtonicon={<FiAlignRight />}label="Align right"value="right"/></ToolbarToggleGroup><ToolbarDivider /><ToolbarToggleGroup spacing="1" type="checkbox"><ToolbarToggleButton icon={<FiBold />} label="Bold" value="bold" /><ToolbarToggleButtonicon={<FiItalic />}label="Italic"value="italic"/><ToolbarToggleButtonicon={<FiUnderline />}label="Underline"value="underline"/></ToolbarToggleGroup><ToolbarDivider /><ToolbarButton icon={<FiLink />} label="Create link" /><Spacer /><ToolbarButton label="Save" variant="solid" colorScheme="primary" /></Toolbar>)}
Sizes#
Toolbar supports the following sizes, xs
, sm
, md
, lg
.
import { Spacer } from '@chakra-ui/react'import { FiAlignLeft, FiAlignCenter, FiAlignRight } from 'react-icons/fi'import { FiBold, FiItalic, FiUnderline, FiLink } from 'react-icons/fi'import {Toolbar,ToolbarButton,ToolbarDivider,ToolbarToggleGroup,ToolbarToggleButton,} from '@saas-ui-pro/react'export default function Sizes() {return (<Toolbar size="xs"><ToolbarToggleGroupspacing="1"defaultValue="left"onChange={console.log}><ToolbarToggleButtonicon={<FiAlignLeft />}label="Align left"value="left"/><ToolbarToggleButtonicon={<FiAlignCenter />}label="Align center"value="center"/><ToolbarToggleButtonicon={<FiAlignRight />}label="Align right"value="right"/></ToolbarToggleGroup><ToolbarDivider /><ToolbarToggleGroup spacing="1" type="checkbox"><ToolbarToggleButton icon={<FiBold />} label="Bold" value="bold" /><ToolbarToggleButtonicon={<FiItalic />}label="Italic"value="italic"/><ToolbarToggleButtonicon={<FiUnderline />}label="Underline"value="underline"/></ToolbarToggleGroup><ToolbarDivider /><ToolbarButton icon={<FiLink />} label="Create link" /><Spacer /><ToolbarButton label="Save" variant="solid" colorScheme="primary" /></Toolbar>)}
Was this helpful?