-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Describe the problem
Every CSS rule applied internally to a component that you want to override from the outside with global CSS requires the !important
keyword. See REPL.
Describe the proposed solution
Recessive CSS rules, i.e. rules with lowest possible specificity no matter with what selector they were set with inside the component.
Not sure what's the word to use here. Just using recessive in the style of genes where the dominant allele is the one expressed in the phenotype while recessive alleles are masked.
Such rules could be placed inside a special scope (similar to :root {}
) or perhaps applied through a class with a special keyword so the svelte compiler knows to apply these rules with low specificity.
Alternatives considered
Creating CSS variables for every CSS rule in a component gets old fast. Plus changing these CSS props is quite verbose. E.g. to specify just four colors:
<MultiSelect
--sms-options-bg="white"
--sms-li-active-bg="cornflowerblue"
--sms-li-disabled-bg="gray"
--sms-readonly-bg="lightgray" />
Importance
would make my life easier