Skip to content

Feature proposal: Allow providing CSS classes for all components #9

@techninja1008

Description

@techninja1008

Currently, the only way to add custom styles to a component is to use CSS selectors, which are either too broad (eg. using mwc-textfield will get all textfields) or require wrapping with an element annotated with a custom class (eg. using the rule .foo-class > mwc-textfield). This makes material-yew difficult to use with frameworks such as tailwindcss.com.

I propose a solution as follows: add a class property to all existing components. This would look similar to the following:

...
#[prop_or_default]
pub classes: Cow<'static, str>,
...

It would only be passed straight through to the underlying MWC component, so ideally each material-yew component would only have three lines of additions.

I'd be grateful to hear your thoughts on this - I'm happy to contribute such a change via a PR if you deem it to be suitable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions