Skip to content

Commit db3ba66

Browse files
authored
feat(api/typescript): Document use of CSSProperties type. (vuejs#1470)
1 parent b27e906 commit db3ba66

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/api/utility-types.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,30 @@ Used to augment allowed TSX props in order to use non-declared props on TSX elem
101101
:::tip
102102
Augmentations must be placed in a module `.ts` or `.d.ts` file. See [Type Augmentation Placement](/guide/typescript/options-api.html#augmenting-global-properties) for more details.
103103
:::
104+
105+
## CSSProperties
106+
107+
Used to augment allowed values in style property bindings.
108+
109+
- **Example**
110+
111+
Allow any custom CSS property
112+
113+
```ts
114+
declare module 'vue' {
115+
interface CSSProperties {
116+
[key: `--${string}`]: string
117+
}
118+
}
119+
```
120+
121+
```tsx
122+
<div style={ { '--bg-color': 'blue' } }>
123+
```
124+
```html
125+
<div :style="{ '--bg-color': 'blue' }">
126+
```
127+
128+
:::tip
129+
Augmentations must be placed in a module `.ts` or `.d.ts` file. See [Type Augmentation Placement](/guide/typescript/options-api.html#augmenting-global-properties) for more details.
130+
:::

0 commit comments

Comments
 (0)