@@ -313,6 +313,7 @@ React.createElement(() => {
313313 <ModalBody>
314314 <ModalContent>
315315 <Radio
316+ id="modal-footer-justify"
316317 label="Footer justification"
317318 onChange={(e) => setModalJustify(e.target.value)}
318319 options={[
@@ -690,6 +691,91 @@ React.createElement(() => {
690691});
691692```
692693
694+ ## Color Variants
695+
696+ Modal can be colored using the ` color ` prop. The ` color ` prop implements the
697+ [ Feedback color collection] ( /docs/foundation/collections#colors )
698+ and is applied to the border of the modal and the modal footer.
699+
700+ ``` docoff-react-preview
701+ React.createElement(() => {
702+ const [modalOpen, setModalOpen] = React.useState(false);
703+ const [modalColor, setModalColor] = React.useState('success');
704+ const modalCloseButtonRef = React.useRef();
705+ {/*
706+ The `preventScrollUnderneath` feature is necessary for Modals to work in
707+ React UI docs. You may not need it in your application.
708+ */}
709+ return (
710+ <GlobalPropsProvider globalProps={{
711+ Modal: { preventScrollUnderneath: window.document.documentElement }
712+ }}>
713+ <Button
714+ label="Launch modal with color options"
715+ onClick={() => setModalOpen(true)}
716+ />
717+ <div>
718+ {modalOpen && (
719+ <Modal
720+ closeButtonRef={modalCloseButtonRef}
721+ color={modalColor}
722+ >
723+ <ModalHeader>
724+ <ModalTitle>Modal color</ModalTitle>
725+ <ModalCloseButton onClick={() => setModalOpen(false)} />
726+ </ModalHeader>
727+ <ModalBody>
728+ <ModalContent>
729+ <Radio
730+ id="modal-color"
731+ label="Modal color"
732+ onChange={(e) => setModalColor(e.target.value)}
733+ options={[
734+ {
735+ label: 'success',
736+ value: 'success',
737+ },
738+ {
739+ label: 'warning',
740+ value: 'warning',
741+ },
742+ {
743+ label: 'danger',
744+ value: 'danger',
745+ },
746+ {
747+ label: 'info',
748+ value: 'info',
749+ },
750+ {
751+ label: 'help',
752+ value: 'help',
753+ },
754+ {
755+ label: 'note',
756+ value: 'note',
757+ },
758+ ]}
759+ value={modalColor}
760+ />
761+ </ModalContent>
762+ </ModalBody>
763+ <ModalFooter>
764+ <Button
765+ color={modalColor}
766+ label="Close"
767+ onClick={() => setModalOpen(false)}
768+ ref={modalCloseButtonRef}
769+ />
770+ </ModalFooter>
771+ </Modal>
772+ )}
773+ </div>
774+ </GlobalPropsProvider>
775+ );
776+ });
777+ ```
778+
693779## Mouse and Keyboard Control
694780
695781Modal can be controlled either by mouse or keyboard. To enhance user
@@ -1207,6 +1293,21 @@ accessibility.
12071293| ` --rui-Modal--fullscreen__height ` | Height of fullscreen modal |
12081294| ` --rui-Modal__animation__duration ` | Duration of animation used (when opening modal) |
12091295
1296+ ### Theming Variants
1297+
1298+ It's possible to adjust the theme of specific color variant. Naming convention
1299+ looks as follows:
1300+
1301+ ` --rui-Modal--<COLOR>__<PROPERTY> `
1302+
1303+ Where:
1304+
1305+ - ` <COLOR> ` is a value from supported
1306+ [ color collections] ( /docs/foundation/collections#colors )
1307+ (check [ color variants] ( #color-variants ) and [ API] ( #api ) to see which
1308+ collections are supported),
1309+ - ` <PROPERTY> ` is one of ` border-color ` or ` background-color ` .
1310+
12101311[ button-attributes ] : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
12111312[ controlled-components ] : /docs/getting-started/usage#foundation-css
12121313[ dialog-attributes ] : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#attributes
0 commit comments