App Shell
The AppShell component is the main outer frame of an application. It provides the basic architecture to build an application inside of our admin.
import React from "react";
import { Box, Button, Icon, Text } from "@nimbus-ds/components";
import { ChevronLeftIcon, GiftBoxIcon, UserIcon } from "@nimbus-ds/icons";
import { AppShell } from "@nimbus-ds/patterns";
const Example: React.FC = () => {
const backButton = (
<Button appearance="transparent">
<Icon source={<ChevronLeftIcon />} />
Volver
</Button>
);
const buttonStack = (
<>
<Button appearance="transparent">
<Icon source={<GiftBoxIcon />} />
Novedades
</Button>
<Button appearance="transparent">
<Icon source={<UserIcon />} />
Mi cuenta
</Button>
</>
);
const sampleMenu = (
<Box
backgroundColor="primary-surface"
borderColor="primary-interactive"
borderStyle="dashed"
borderWidth="1"
borderRadius="2"
width="15rem"
height="100vh"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text fontSize="base" color="primary-interactive">
Menu content
</Text>
</Box>
);
return (
<AppShell menu={sampleMenu}>
<AppShell.Header leftSlot={backButton} rightSlot={buttonStack} />
<Box
backgroundColor="primary-surface"
borderColor="primary-interactive"
borderStyle="dashed"
borderWidth="1"
borderRadius="2"
width="100%"
height="calc(100vh - 66px)"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text fontSize="base" color="primary-interactive">
Children content
</Text>
</Box>
</AppShell>
);
};
export default Example;
Instalá el componente via terminal.
npm install @nimbus-ds/app-shell
Las propiedades adicionales se pasan al elemento <AppShell>. Consultá la documentación para ver la lista de atributos aceptados por el elemento <AppShell>.
AppShell
Name | Type | Default | Description |
---|---|---|---|
children* | React.ReactNode | Content for the body of the application. | |
menu | React.ReactNode | Optional slot for left sidebar menu. | |
menuProperties | object | Can be used to control the responsive properties of the AppShell menu so you can change which breakpoint the menu hides under. | |
menuExpanded | boolean | Controls whether the left sidebar (menu) is expanded (true) or collapsed (false). Defaults to true. | |
menuExpandedWidth | string | Sidebar width when expanded. Defaults to "240px". This is a responsive property and you can have the options below available for you to use. '{ "focus": "value", "focusWithin": "value", "active": "value", "hover": "value", "disabled": "value", "xs": "value", "md": "value", "lg": "value", "xl": "value" }' | |
menuCollapsedWidth | string | Sidebar width when collapsed (rail). If provided, the sidebar will render in a compact rail while collapsed. Defaults to "48px". This is a responsive property and you can have the options below available for you to use. '{ "focus": "value", "focusWithin": "value", "active": "value", "hover": "value", "disabled": "value", "xs": "value", "md": "value", "lg": "value", "xl": "value" }' | |
menuBehavior | 'inline' | Determines how the left sidebar behaves when collapsed. - 'inline': current behavior; width changes affect layout. - 'popover': when collapsed, hovering or clicking the rail shows the expanded menu as an overlay without affecting layout. | |
menuFlyout | object | Configuration options for the AppShell flyout (popover) behavior when the menu is collapsed. This consolidates all popover-related props into a single object for simpler usage, while keeping individual top-level props for backward compatibility. | |
contentProperties | object | Consolidated configuration for the content container. |
AppShell.Header
Name | Type | Default | Description |
---|---|---|---|
leftSlot | React.ReactNode | Optional content for the left-hand-side slot. | |
rightSlot | React.ReactNode | Optional content for the right-hand-side slot. |
AppShell.Body
Name | Type | Default | Description |
---|
AppShell.Chat
Name | Type | Default | Description |
---|