Skip to Content

DialogTitle

This component is a utility component designed for the Dialog component.

Dialog title
Content
Expand code
<Button variant={'outlined'} onClick={() => {setIsVisible(true)}}>Show Dialog</Button> <Dialog size={'small'} open={isVisible} onCancel={() => setIsVisible(false)}> <DialogTitle>Dialog title</DialogTitle> <DialogContent>Content</DialogContent> <DialogControls> <Button variant={'outlined'} onClick={() => {setIsVisible(false)}}>Close</Button> </DialogControls> </Dialog>

Since dialogTitle is a utility component, using it outside the dialog component will just render the content of the component:

Dialog title
<DialogTitle>Dialog title</DialogTitle>

Customization

The background-color of the dialog-title can be changed based on the dialog’s context.

Dialog title
Content
Dialog title
Content
Dialog title
Content
Dialog title
Content
Expand code
<Button variant={'outlined'} onClick={() => {setIsVisible(true)}}>Show Dialog</Button> <Dialog size={'small'} open={isVisible} onCancel={() => setIsVisible(false)}> <DialogTitle color={'success'}>Dialog title</DialogTitle> // one of 'info' | 'success' | 'warning' | 'error' <DialogContent>Content</DialogContent> <DialogControls> <Button variant={'outlined'} onClick={() => {setIsVisible(false)}}>Close</Button> </DialogControls> </Dialog>

Accessibility

Use the id prop in combination with the dialog’s labelledby prop to add additional context for Accessibility-Tools.

Dialog title
Content
Expand code
<Button variant={'outlined'} onClick={() => {setIsVisible(true)}}>Show Dialog</Button> <Dialog size={'small'} open={isVisible} labelledby={'dialog-title'} onCancel={() => setIsVisible(false)}> <DialogTitle id={'dialog-title'}>Dialog title</DialogTitle> <DialogContent>Content</DialogContent> <DialogControls> <Button variant={'outlined'} onClick={() => {setIsVisible(false)}}>Close</Button> </DialogControls> </Dialog>

Props

NameTypeDefaultDescription
childrennode-Content of the component
colorinfo | success | warning | error-Set the color of the component
idstring-Set the id attribute
Last updated on