CSS custom properties
See original GitHub issueI am writing an app in React and Typescript and will be making heavy use of CSS custom properties.
Could you idiot-proof the documentation a bit more please? Is css.d.ts
a file I need to create and does it matter what directory it is in?
// My css.d.ts file
import * as CSS from 'csstype';
declare module 'csstype' {
interface Properties {
// Add a missing property
WebkitRocketLauncher?: string;
// Add a CSS Custom Property
'--theme-color'?: 'black' | 'white';
// ...or allow any other property
[index: string]: any;
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Custom properties (--*): CSS variables - MDN Web Docs
Custom properties are scoped to the element(s) they are declared on, and participate in the cascade: the value of such a custom property...
Read more >A Complete Guide to Custom Properties | CSS-Tricks
Custom properties are different than preprocessor variables · Native CSS custom properties are more powerful then preprocessor variables. · Native ...
Read more >CSS Custom Properties for Cascading Variables Module Level 1
Custom properties are ordinary properties, so they can be declared on any element, are resolved with the normal inheritance and cascade rules, ...
Read more >A Strategy Guide To CSS Custom Properties
CSS Custom Properties are by default locally scoped to the specific selectors we apply them to. So they are kinda like local variables....
Read more >CSS Custom Properties (CSS Variables) Sample
CSS custom properties allow you to store and retrieve values from properties you define yourself. They follow the same rules as other CSS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
TypeScript 4.4 does allow specifying types for properties with a pattern. In this case you can specify something like this:
I will recommend you to do the following strategy.