-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[app-layout] Add CSS custom property to customize drawer width #950
Comments
That sounds a good enhancement for the component. Thanks! |
Yeah, would be straightforward to expose a new custom property and use that for setting the other offset property. |
I agree with OP that it would be nice to have styling control over the drawer width. However, you can achieve a lot of style control by following the pattern Vaadin uses to ship components with both lumo and material themes. First, create a
For a quick and dirty solution, you can copy the contents of a theme file (I copied I heavily modified the app layout theme file for my app, but to set the drawer width (and background), I have: [part="drawer"],
:host([overlay]) [part="drawer"]::before {
background: var(--my-bg-1-color);
width: 312px;
} You could also probably just use a CSS var instead of a fixed value, but I hadn't tried it since this was used just for a proof of concept.
Import the theme file you just created and the app layout module. import './my-app-layout-styles.js';
import '../../node_modules/@vaadin/vaadin-app-layout/src/vaadin-app-layout.js'; Then, just import in your app the |
Easy solution for change drawer width: add css import |
Shouldn't |
@anezthes, well, not really. The value of that custom property is set during the rendering and is measured from the actual width of the drawer. You could set the width of the drawer to |
Proposed name: |
There is a way to update the size of the drawer and the offset dynamically? |
Depends on what you mean by "dynamically". You can change the value of Unfortunately you can't make the drawer's width scale automatically to fit its contents. |
Right now the drawer width is fixed at 16em. For those of us with small tab names, it can create a bit too much blank space. It would be nice to be able to set that as a CSS variable. It looks like the main area is already being offset from the drawer programmatically.
The text was updated successfully, but these errors were encountered: