Drawer
<gstock-drawer>
|
GstockDrawer
API
Propiedades
| Nombre | Descripción | Reflects | Tipo | Por defecto |
|---|---|---|---|---|
modal
|
Exposes the internal modal utility that controls focus trapping. To
temporarily disable focus trapping and allow third-party modals spawned
from an active Gstock modal, call
modal.activateExternal() when the third-party modal opens.
Upon closing, call modal.deactivateExternal() to restore
Gstock’s focus trapping.
|
-
|
new GstockModal(this)
|
|
open
|
Indicates whether or not the drawer is open. You can toggle this attribute
to show and hide the drawer, or you can use the show() and
hide() methods and this attribute will reflect the drawer’s
open state.
|
|
boolean
|
false
|
label
|
The drawer’s label as displayed in the header. You should always include a
relevant label even when using
no-header, as it is required for proper accessibility. If you
need to display HTML, use the label slot instead.
|
|
string
|
''
|
placement
|
The direction from which the drawer will open. |
|
'top' | 'end' | 'bottom' | 'start'
|
'start'
|
contained
|
By default, the drawer slides out of its containing block (usually the
viewport). To make the drawer slide out of its parent element, set this
attribute and add position: relative to the parent.
|
|
boolean
|
false
|
noHeader
no-header
|
Removes the header. This will also remove the default close button, so please ensure you provide an easy, accessible way for users to dismiss the drawer. |
|
boolean
|
false
|
updateComplete
|
A read-only promise that resolves when the component has finished updating. |
Aprende más sobre atributos y propiedades .
Eventos
| Nombre | React Event | Descripción | Event Detail |
|---|---|---|---|
gstock-show-event
|
onGstockShowEvent
|
Emitted when the drawer opens. | - |
gstock-after-show-event
|
onGstockAfterShowEvent
|
Emitted after the drawer opens and all animations are complete. | - |
gstock-hide-event
|
onGstockHideEvent
|
Emitted when the drawer closes. | - |
gstock-after-hide-event
|
onGstockAfterHideEvent
|
Emitted after the drawer closes and all animations are complete. | - |
gstock-initial-focus-event
|
onGstockInitialFocusEvent
|
Emitted when the drawer opens and is ready to receive focus. Calling
event.preventDefault() will prevent focusing and allow you to
set it on a different element, such as an input.
|
- |
gstock-request-close-event
|
onGstockRequestCloseEvent
|
Emitted when the user attempts to close the drawer by clicking the close
button, clicking the overlay, or pressing escape. Calling
event.preventDefault() will keep the drawer open. Avoid using
this unless closing the drawer will result in destructive behavior such as
data loss.
|
{ source: 'close-button' | 'keyboard' | 'overlay' }
|
Aprende más sobre eventos .
Slots
| Nombre | Descripción |
|---|---|
default
|
The drawer’s main content. |
label
|
The drawer’s label. Alternatively, you can use the
label attribute.
|
header-actions
|
Optional actions to add to the header. Works best with
<gstock-icon-button>.
|
footer
|
The drawer’s footer, usually one or more buttons representing various options. |
Aprende más sobre slots .
Métodos
| Nombre | Descripción |
|---|---|
show( )
|
Shows the drawer. |
hide( )
|
Hides the drawer |
Aprende más sobre métodos .
Propiedades personalizadas
| Nombre | Descripción | Default |
|---|---|---|
--size
|
The preferred size of the drawer. This will be applied to the drawer’s
width or height depending on its placement. Note that the
drawer will shrink to accommodate smaller screens.
|
|
--header-spacing
|
The amount of padding to use for the header. | |
--body-spacing
|
The amount of padding to use for the body. | |
--footer-spacing
|
The amount of padding to use for the footer. |
Aprende más sobre propiedades personalizadas .
Partes
| Nombre | Descripción |
|---|---|
base
|
The component’s base wrapper. |
overlay
|
The overlay that covers the screen behind the drawer. |
panel
|
The drawer’s panel (where the drawer and its content are rendered). |
header
|
The drawer’s header. This element wraps the title and header actions. |
header-actions
|
Optional actions to add to the header. Works best with
<gstock-icon-button>.
|
title
|
The drawer’s title. |
close-button
|
The close button, an <gstock-icon-button>. |
close-button__base
|
The close button’s exported base part. |
body
|
The drawer’s body. |
footer
|
The drawer’s footer. |
Aprende más sobre partes CSS .
Animaciones
| Nombre | Descripción |
|---|---|
drawer.showTop
|
The animation to use when showing a drawer with
top placement.
|
drawer.showEnd
|
The animation to use when showing a drawer with
end placement.
|
drawer.showBottom
|
The animation to use when showing a drawer with
bottom placement.
|
drawer.showStart
|
The animation to use when showing a drawer with
start placement.
|
drawer.hideTop
|
The animation to use when hiding a drawer with top placement.
|
drawer.hideEnd
|
The animation to use when hiding a drawer with end placement.
|
drawer.hideBottom
|
The animation to use when hiding a drawer with
bottom placement.
|
drawer.hideStart
|
The animation to use when hiding a drawer with
start placement.
|
drawer.denyClose
|
The animation to use when a request to close the drawer is denied. |
drawer.overlay.show
|
The animation to use when showing the drawer’s overlay. |
drawer.overlay.hide
|
The animation to use when hiding the drawer’s overlay. |
Aprende más sobre animaciones .
Dependencias
Este componente importa automáticamente las siguientes dependencias.