Skip to content
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

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

Open
techninja1008 opened this issue Jun 4, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@techninja1008
Copy link

techninja1008 commented Jun 4, 2021

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.

@ranile ranile added the enhancement New feature or request label Jun 13, 2021
@ranile
Copy link
Owner

ranile commented Jun 13, 2021

This would be a great addition but adding classes prop seems like a bandage over a much bigger issue, unable to pass props (such as classes) to components without defining everything manually. A actual solution was proposed for this here: yewstack/yew#1533 (comment).

If you can, I think it would be great if you could work on that for Yew. I'd prefer to have this solved at framework-level instead of a putting a bandage over the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants