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