import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; import { ModalContent } from './modal-content'; # ModalContent `ModalContent` is the container for the modal dialog's content. It uses context supplied by the `Modal` component and cannot be used without it. ## Props The `ModalContent` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props ### Children Use the `children` prop to render the content of `ModalContent`. The `ModalContent` should generally be used with the `ModalHeader` component. ```jsx import React, { useState } from 'react'; import { Modal, ModalContent, ModalHeader, Text, Button, BUTTON_VARIANT } from '../../component-library'; const [show, setShow] = useState(false); const handleOnClick = () => { setShow(!show); }; Modal Header Modal Content ``` ### Size Currently the `ModalContent` supports a single size, this decision was made after we ran an audit on all modal sizes in the extension codebase and found that all modals could be made to fit the `ModalContentSize.Sm`(360px) size. If you do require a larger modal size you can use the `modalDialogProps` to add a className to override the default size. ```jsx import { DISPLAY } from '../../../helpers/constants/design-system'; import Box from '../../ui/box'; import { Modal, ModalContent, Text, Button, BUTTON_VARIANT } from '../../component-library'; enum ModalContentSizeStoryOption { Sm = 'sm', ClassName = 'className', } const [show, setShow] = useState({ sm: false, className: false, }); const handleOnClick = (size: ModalContentSizeStoryOption) => { setShow({ ...show, [size]: !show[size] }); }; handleOnClick(ModalContentSizeStoryOption.Sm)} > ModalContentSize.Sm default and only size 360px max-width handleOnClick(ModalContentSizeStoryOption.ClassName)} > Using modalDialogProps and adding a className setting a max width (max-width: 800px) ```