Side Modal
Sidemodal navigation provides access to the parts within its application. The side sections have the supplementary content that is linked on the left or right side of the screen.
import React, { useState } from "react";
import { SideModal } from "@nimbus-ds/patterns";
import { Box, Button, Icon, Text } from "@nimbus-ds/components";
import { CheckCircleIcon, ChevronLeftIcon } from "@nimbus-ds/icons";
const Example: React.FC = () => {
const [open, setOpen] = useState(false);
const handleOpen = () => setOpen(!open);
const headerAction = (
<Box display="flex" alignItems="center" gap="1">
<Icon color="primary-textHigh" source={<ChevronLeftIcon />} />
<Text fontWeight="bold" fontSize="highlight">
Formas de entrega
</Text>
</Box>
);
return (
<>
<Button onClick={handleOpen}>Open</Button>
<SideModal
onRemove={handleOpen}
open={open}
maxWidth={{ xs: "100%", md: "340px", lg: "540px" }}
title="Instalar Kangu"
headerIcon={
<Icon color="primary-textHigh" source={<CheckCircleIcon />} />
}
padding="base"
paddingHeader="none"
paddingBody="none"
paddingFooter="none"
headerAction={headerAction}
footer={{
primaryAction: { children: "Button" },
secondaryAction: { children: "Button", appearance: "primary" },
}}
>
<Box
borderStyle="dashed"
borderWidth="1"
borderColor="neutral-interactive"
height="100%"
boxSizing="border-box"
display="flex"
justifyContent="center"
alignItems="center"
>
<Text textAlign="center" fontSize="base">
Replace me with your content
</Text>
</Box>
</SideModal>
</>
);
};
export default Example;
Instala o componente via terminal.
npm install @nimbus-ds/side-modal
Additional props are passed to the <SideModal> element. See div docs for a list of props accepted by the <SideModal> element.
SideModal
Name | Type | Default | Description |
---|---|---|---|
title | string | Title. | |
titleAction | React.ReactNode | Action Title | |
headerAction | React.ReactNode | Action Header | |
headerIcon | React.ReactNode | Icon Header | |
children | React.ReactNode | Body Content | |
paddingHeader | 'base' | Header padding. | |
paddingBody | 'base' | Body padding. | |
paddingFooter | 'base' | Footer padding. | |
footer | object | Footer element actions. | |
open | boolean | 'true' | Determines if the sidebar is shown or not. |
maxWidth | string | '375px' | The maxWidth property specifies the maxWidth of a sidebar's content area. This is a responsive property and you can have the options below available for you to use. '{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }' |
padding | 'base' | 'base' | The padding properties are used to generate space around an sidebar's content area. |
position | 'left' | 'right' | Side from which the sidebar will appear. |
zIndex | '100' | The zIndex property specifies the stack order of the sidebar. This is a responsive property and you can have the options below available for you to use. '{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }' | |
onRemove | object | Callback fired when the component requests to be closed. () => void; |