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

V3 - how to style input and selected item wrapper? #51

Closed
dontwork opened this issue Jun 5, 2019 · 9 comments
Closed

V3 - how to style input and selected item wrapper? #51

dontwork opened this issue Jun 5, 2019 · 9 comments

Comments

@dontwork
Copy link

dontwork commented Jun 5, 2019

Hi the input and the wrapper about the Selection component seem to be prohibiting styling. Is there a specific way I should look to do this?

@rob-balfre
Copy link
Owner

containerStyles prop not enough?

@dontwork
Copy link
Author

dontwork commented Jun 6, 2019

I don't think I can modify the default styles of the input or the various wrappers. For instances I am trying to make the select a bit small (less padding, less height, smaller font) but there are styles which set the height with no mechanism to override

@rob-balfre
Copy link
Owner

Yeah, it's not really possible at the moment without implementing CSS variables for most of the styles. You can always fork the repo and change the styles. Not ideal I know. I'll have a think.

@hbendev
Copy link

hbendev commented Jul 4, 2019

Couldn't just all styles be moved to Item, Selection, MultiSelection components, with some additional props (like SelectedValue for Item) passed down. That way if someone wanted to use custom styles, they would just define them in their own components.

I think the optimal solution would be this feature. Then these component-type props wouldn't be required at all. Works very well with UI libaries, like in React.

@subpx
Copy link
Contributor

subpx commented Jul 4, 2019

I made a PR a while ago that makes this a bit easier. #41 It’s for v2 though and still requires custom components.

@rob-balfre
Copy link
Owner

Maybe a combo of @subpx's PR and adding CSS vars would cater for most use-cases and not break Svelte's CSS optimisation?

@rob-balfre
Copy link
Owner

WIP... With great power comes great responsibility...
Screen Shot 2019-07-05 at 10 01 04 am

@rob-balfre
Copy link
Owner

@subpx @dontwork @hajnalbendeguz what you think of CSS var options in 2.1.0-beta.0?
Demo @ https://svelte.dev/repl/9a0c0ca1518346c9aa117d6f6b905fc9?version=3.6.2

@rob-balfre
Copy link
Owner

I've updated repl for Svelte 3.6.3+ changes
https://svelte.dev/repl/b4c6fa312e4b415ca3b154a2d4ad6ced?version=3.6.3

@subpx subpx closed this as completed Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants