Code
Props
children
strin-HTML tags -Custom Components (MenuOption, MenuHeader and MenuDivider)
✅
className
string
❌
title
string
❌
type
string
(Info, Warning, Danger)
❌
show
boolean
❌
commland
boolean
❌
Where to Insert This Component in Comm.land?
This component should overlay all the content inside the application. To keep a better order and avoiding problems with UI Shell, it is recommended inserting this component outside and next to the AppPage component. If it is inserted inside the AppPageContent component, the modal is not going to render correctly.
Children
To generate the structure required for the component, the developer can insert the following components as children elements:
AlertBody
In here, developer can insert all the HTML tags and Components needed.
children
-HTML tags -Custom Components (MenuOption, MenuHeader and MenuDivider)
✅
AlertFooter
This section is designed specifically to be used with the Button Component in the default size.
children
SDS Buttons Component
✅
Example
import React, {useState} from 'react';
import {
Alert,
AlertBody,
AlertFooter,
Text,
Button
} from '@2600hz/sds-react-components';
const Example = ()=>{
//STATE
const [show, setShow] = useState(false);
//ACTIONS
const openAlert = ()=>{
setShow(true);
}
const closeAlert = ()=>{
setShow(false);
}
const customFunction = ()=>{
console.log('It Does Something...');
closeAlert();
}
//CONTENT
return(
<>
<Alert
className='AlertExample'
title='Lorem Ipsum Dolore'
type='Info'
show={show}
>
<AlertBody>
<Text.p>Some random text.</Text.p>
</AlertBody>
<AlertFooter>
<Button
type='Ghost'
onClick={closeAlert}
>Cancel</Button>
<Button
type='Primary'
onClick={customFunction}
>Primary Action</Button>
</AlertFooter>
</Alert>
<Button onClick={openAlert} >Opening Alert Trigger</Button>
</>
)
}
export default Example;
Components Dependency
For this component elaboration, the following internal components were used:
AlertBody
AlertFooter
Live Demo
For detailed code usage documentation, see the Storybooks for each framework below.
React
Last updated