Drawer
Drawer effect provides extra promotion space for web page. It is also a common effect in web pages & APPs, such as Google APP applied it for "image search" or other related "search results". Developers could also apply it for mentioning some information.
<msc-drawer /> provides different themes for light / dark mode and also mobile ready.
Let's take a try and see what can <msc-drawer /> do.
Basic Usage
<msc-drawer /> is a web component. All we need to do is put the required script into your HTML document. Then follow <msc-drawer />'s html structure and everything will be all set.
Required Script
Structure
Put [slot="msc-drawer-content"] inside <msc-drawer /> as its child.
It will use it as content.
Or set attributes directly.
Otherwise, developers could also choose remoteconfig to fetch config for <msc-drawer />.
JavaScript Instantiation
<msc-drawer /> could also use JavaScript to create DOM element. Here comes some examples.
Style Customization
<msc-drawer /> uses CSS variables to style its interface. That means developer could easy change them into the lookup you like.
Attributes
<msc-drawer /> supports some attributes to let it become more convenience & useful.
subject
Set subject for <msc-drawer />.
active
Set active for <msc-drawer />. It will turn <msc-drawer /> on or not. Default is false (not set).
Properties
| Property Name | Type | Description |
|---|---|---|
subject
|
String | Getter / Setter for subject. Developers could use this property to setup subject. |
active
|
Boolean | Getter / Setter for active. It will turn <msc-drawer /> on or not. |
Method
| Methos Signature | Description |
|---|---|
toggle([force])
|
Toggle <msc-drawer /> active or not. When argument is present: If the argument is true, <msc-drawer /> will be turned on, and if it is false, <msc-drawer /> will be turned off. |
Events
| Event Signature | Description |
|---|---|
msc-drawer-switch
|
Fired when <msc-drawer /> turn on or off. Developers could get active through event.detail. |