Drawer
Open a bottom-aligned modal.
Examples
Open a bottom-aligned modal
React code
import {
DialogTrigger,
Drawer,
DialogTitle,
Label,
Checkbox,
DialogClose,
} from "@accelerate/react/components";
export function Example() {
return (
<>
<DialogTrigger aria-controls="filters-drawer">Open filters</DialogTrigger>
<Drawer id="filters-drawer" aria-labelledby="drawer-title">
<DialogTitle id="drawer-title">Filter work items</DialogTitle>
<Label><Checkbox /> Open items only</Label>
<DialogClose>Close filters</DialogClose>
</Drawer>
</>
);
}Angular code
import { Component } from "@angular/core";
import {
AccDialogTrigger,
AccDrawer,
AccDialogTitle,
AccLabel,
AccCheckbox,
AccDialogClose,
} from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccDialogTrigger,
AccDrawer,
AccDialogTitle,
AccLabel,
AccCheckbox,
AccDialogClose,
],
template: `
<button accDialogTrigger aria-controls="filters-drawer">Open filters</button>
<dialog accDrawer id="filters-drawer" aria-labelledby="drawer-title">
<h2 accDialogTitle id="drawer-title">Filter work items</h2>
<label accLabel><input accCheckbox> Open items only</label>
<button accDialogClose>Close filters</button>
</dialog>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Bottom-aligned modal using the dialog parts.
Import the React component Drawer from @accelerate/react/components. For Angular, add AccDrawer to the standalone component’s imports and use <dialog accDrawer>.
Examples use these React parts: DialogTrigger, Drawer, DialogTitle, Label, Checkbox, DialogClose. The Angular examples show the corresponding directives and template hosts.
API reference
- DialogTrigger / DialogClose
- Open and dismiss the native modal.
- aria-labelledby
- Names the drawer from its title.