import { Canvas, Meta, ArgTypes } from '@storybook/blocks';
import { ThemeProvider } from 'styled-components';
import ControlBar from '.';
import ControlBarButton from './ControlBarButton';
import { ControlBarForDocs } from './ControlBar.stories';
import { lightTheme } from '../../../theme/';
import { GlobalStyles } from '../../../theme/GlobalStyles';
import * as ContentBarStories from './ControlBar.stories.tsx';
# ControlBar
The ControlBar component displays a section of controls with icons and labels.
You can place ControlBar into the parent element according to the `layout` prop, e.g. `top`, `bottom`, `right`, `left`, `undocked-horizontal`, and `undocked-vertical`.
The ControlBar component contains one or more `ControlBarButton` components, which can show a label and icon. You can add a dropdown list to each ControlBarButton by setting the [popOver props](/docs/ui-components-popover--page).
`ControlBarButton` support tooltips on any buttons by adding a `data-tooltip` property. Adding a `data-tooltip-position` property controls the tooltip position. The tooltip will render the `label` passed, unless a `tooltipContent` prop is passed.
## Importing
```javascript
import {
ControlBar,
ControlBarButton,
} from 'amazon-chime-sdk-component-library-react';
```
## Example
```jsx
const [muted, setMuted] = useState(false);
const [cameraActive, setCameraActive] = useState(false);
const microphoneButtonProps = {
icon: muted ? : ,
onClick: () => setMuted(!muted),
label: 'Mute',
};
const cameraButtonProps = {
icon: cameraActive ? : ,
popOver: [
{
onClick: () => console.log('camera popover option 1'),
children: Some option text,
},
{
onClick: () => console.log('camera popover option 2'),
children: More option text,
},
],
onClick: () => setCameraActive(!cameraActive),
label: 'Camera',
};
const dialButtonProps = {
icon: ,
onClick: () => console.log('Toggle dial pad'),
label: 'Dial',
};
const hangUpButtonProps = {
icon: ,
onClick: () => console.log('End meeting'),
label: 'End',
};
const volumeButtonProps = {
icon: ,
onClick: () => console.log('Volume button clicked'),
popOver: [
{
onClick: () => console.log('volume popover option 1'),
children: Some option text,
},
{
onClick: () => console.log('volume popover option 2'),
children: More option text,
},
],
label: 'Volume',
};
const laptopButtonProps = {
icon: ,
onClick: () => console.log('Screen button clicked'),
label: 'Screen',
};
return (
);
```
## Props
#### ControlBar Component
#### ControlBarButton Component