import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import { ModalHeader } from './modal-header';
# ModalHeader
`ModalHeader` handles the title, close button and back button for all Modal components. It is built on top of the [HeaderBase](/docs/components-componentlibrary-headerbase--default-story) component
## Props
The `ModalHeader` accepts all props below as well as all [Box](/docs/ui-components-ui-box-box-stories-js--default-story#props) component props
### Children
The title of the `ModalHeader` component. Passing a `string` will render the content inside of a `Text` component. Passing any other type will render the content as is.
```jsx
import {
TextVariant,
TextAlign,
DISPLAY,
FLEX_DIRECTION,
AlignItems,
JustifyContent,
} from '../../../helpers/constants/design-system';
import { ModalHeader, AvatarAccount, Text } from '../../component-library';
Children as string
Custom header using multiple components
```
### onBack
Use the onClick handler `onBack` prop to render the `ButtonIcon` back button in the startAccessory position.
Use the `backButtonProps` prop to pass additional props to the `ButtonIcon` back button.
```jsx
import { ModalHeader } from '../../component-library';
console.log('Back button click')}>
OnBack Demo
;
```
### onClose
Use the onClick handler `onClose` prop to render the `ButtonIcon` back button in the endAccessory position.
Use the `backButtonProps` prop to pass additional props to the `ButtonIcon` back button.
```jsx
import { ModalHeader } from '../../component-library';
console.log('Back button click')}>
OnClose Demo
;
```
### startAccessory
Use the `startAccessory` prop to render a component in the startAccessory position. This will override the default back `ButtonIcon`.
```jsx
import { ModalHeader, Button, BUTTON_SIZES } from '../../component-library';
Demo}>
StartAccessory
;
```
### endAccessory
Use the `endAccessory` prop to render a component in the endAccessory position. This will override the default close `ButtonIcon`.
```jsx
import { ModalHeader, Button, BUTTON_SIZES } from '../../component-library';
Demo}>
EndAccessory
;
```