wes-goulet / side-drawer

A simple side drawer written as HTML custom element
https://side-drawer.goulet.dev
MIT License
40 stars 8 forks source link

Offset from left #98

Closed ozanmuyes closed 2 months ago

ozanmuyes commented 2 months ago

Is it possible to give it some offset from left (if it's not righted) or offset from right (if <side-drawer right>)? I saw the applicable CSS properties, but they are not useful for what I want to achieve.

ozanmuyes commented 2 months ago

This is to fulfill my use-case but I think it's a common use-case to have so-called collapsed drawers / sidebars when closed it won't hide away but collapses to a minified version of the drawer / sidebar.

wes-goulet commented 2 months ago

@ozanmuyes This should be possible today, the underlying dialog is exposed as a part, so something like the following should work:

side-drawer::part(dialog) {
  left: 80px;
}

Will that work for your use case? I'd rather consumers leverage the dialog part over adding more CSS properties (and expanding the component's API surface).

ozanmuyes commented 2 months ago

I wasn't aware of ::part(), thanks!