Drawer
A panel which slides in from the edge of the screen.
When To Use
A Drawer is a panel that is typically overlaid on top of a page and slides in from the side.
It contains a set of information or actions.
Since the user can interact with the Drawer without leaving the current page,
tasks can be achieved more efficiently within thesame context.
- Use a Form to create or edit a set of information.
- Processing subtasks. When subtasks are too heavy for a Popover and we still want to keep the subtasks in the context of the main task, Drawer comes very handy.
- When the same Form is needed in multiple places.
Examples
Drawer API#
| Property | Description | Type | Default Value |
|---|---|---|---|
| ChildContent | ParameterThe content of Drawer. | RenderFragment | -- |
| Content | ParameterThe content of Drawer. If |
OneOf<RenderFragment, String> | -- |
| Closable | ParameterWhether a close (x) button is visible on top right of the Drawer dialog or not. | Boolean | true |
| MaskClosable | ParameterClicking on the mask (area outside the Drawer) to close the Drawer or not. | Boolean | true |
| Mask | ParameterWhether to show mask or not. | Boolean | true |
| MaskStyle | ParameterStyle for Drawer's mask element. | String | -- |
| Keyboard | ParameterWhether to support keyboard esc off | Boolean | true |
| Title | ParameterThe title for Drawer. | OneOf<RenderFragment, String> | -- |
| Placement | ParameterThe placement of the Drawer, option could be left, top, right, bottom | DrawerPlacement | right |
| BodyStyle | ParameterBody style for modal body element. Such as height, padding etc. | String | -- |
| HeaderStyle | ParameterHeader style for modal header element. Such as height, padding etc. | String | -- |
| WrapClassName | ParameterThe class name of the container of the Drawer dialog. | String | -- |
| Width | ParameterWidth of the Drawer dialog, only when placement is 'left' or 'right'. | String | 256 |
| Height | ParameterHeight of the Drawer dialog, only when placement is 'top' or 'bottom'. | String | 256 |
| ZIndex | ParameterThe z-index of the Drawer. | Int32 | 1000 |
| OffsetX | ParameterThe the X coordinate offset(px), only when placement is 'left' or 'right'. | Int32 | 0 |
| OffsetY | ParameterThe the Y coordinate offset(px), only when placement is 'top' or 'bottom'. | Int32 | 0 |
| Visible | ParameterWhether the Drawer dialog is visible or not. | Boolean | false |
| VisibleChanged | ParameterEventCallback trigger on Visible was changed. | EventCallback<Boolean> | -- |
| OnOpen | ParameterSpecify a callback that will be called before drawer displayed | EventCallback | -- |
| OnClose | ParameterSpecify a callback that will be called when a user clicks mask, close button or Cancel button. | EventCallback | -- |
| Handler | Parameter | RenderFragment | -- |
| Id | ParameterID for the component's HTML | String | Uniquely Generated ID |
| Class | ParameterSpecifies one or more class names for an DOM element. | String | -- |
| Style | ParameterSpecifies an inline style for a DOM element. | String | -- |
| RefBack | ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. |
ForwardRef | -- |
DrawerService API#
| Method Signature | Return Type | Description |
|---|---|---|
| CreateAsync(DrawerOptions options) | Task<DrawerRef> | Create and open a simple drawer without result |
| CreateAsync(DrawerOptions config, TComponentOptions options) | Task<DrawerRef<TResult>> | Create and open a drawer with the template |
| UpdateAsync(DrawerRef drawerRef) | Task | Update a drawer |
| CreateDialogAsync(DrawerOptions config, TComponentOptions options) | Task<TResult> | Create and open a drawer |
| CreateDialogAsync(TComponentOptions options, Boolean closable, Boolean maskClosable, String title, String width, Boolean mask, DrawerPlacement placement) | Task<TResult> |
DrawerOptions API#
| Property | Description | Type | Default Value |
|---|---|---|---|
| Content | The drawer body content. | OneOf<RenderFragment, String> | -- |
| ChildContent | RenderFragment | -- | |
| Closable | Whether a close (x) button is visible on top right of the Drawer dialog or not. | Boolean | true |
| MaskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | Boolean | true |
| Mask | Whether to show mask or not. | Boolean | true |
| Keyboard | Whether to support keyboard esc off | Boolean | true |
| Title | The title for Drawer. | OneOf<RenderFragment, String> | -- |
| Placement | The placement of the Drawer - Possible values: "left", "right", "top", "bottom" | DrawerPlacement | DrawerPlacement.Right |
| MaskStyle | Style for Drawer's mask element. | String | -- |
| BodyStyle | Body style for Drawer body element. Such as height, padding etc. | String | -- |
| HeaderStyle | Header style for Drawer header element. Such as height, padding etc. | String | -- |
| WrapClassName | The class name of the container of the Drawer dialog. | String | -- |
| Width | Width of the Drawer dialog. | String | 256 |
| Height | Height of the Drawer dialog, only when placement is 'top' or 'bottom'. | String | 256 |
| ZIndex | The z-index of the Drawer. | Int32 | 1000 |
| OffsetX | The the X coordinate offset(px), only when placement is 'left' or 'right'. | Int32 | 0 |
| OffsetY | The the Y coordinate offset(px), only when placement is 'top' or 'bottom'. | Int32 | 0 |
| Visible | If the drawer is visible or not | Boolean | false |