@@ -19,10 +19,11 @@ A function to create a `style component` that can be used to handle global style
19
19
** Usage**
20
20
21
21
``` vue
22
+
22
23
<script setup>
23
- import { createGlobalStyle } from '@vue3-styled-components/package'
24
+ import { createGlobalStyle } from '@vue3-styled-components/package'
24
25
25
- const GlobalStyle = createGlobalStyle`
26
+ const GlobalStyle = createGlobalStyle`
26
27
body {
27
28
color: ${(props) => props.color};
28
29
}
@@ -48,18 +49,19 @@ A function to generate keyframes. It takes a template literal as an argument and
48
49
** Usage**
49
50
50
51
``` vue
52
+
51
53
<script setup lang="ts">
52
- import { styled, keyframes } from '@vue3-styled-components/package'
54
+ import { styled, keyframes } from '@vue3-styled-components/package'
53
55
54
- const animation = keyframes`
56
+ const animation = keyframes`
55
57
from {
56
58
opacity: 0;
57
59
}
58
60
to {
59
61
opacity: 1;
60
62
}
61
63
`
62
- const DivWithAnimation = styled('div')`
64
+ const DivWithAnimation = styled('div')`
63
65
width: 100%;
64
66
height: 40px;
65
67
animation: ${animation} 2s ease-in infinite;
@@ -70,9 +72,43 @@ const DivWithAnimation = styled('div')`
70
72
</template>
71
73
```
72
74
75
+ ## ` css `
76
+
77
+ A function to generate CSS from a template literal with interpolations.
78
+
79
+ ** Augments**
80
+
81
+ - Tagged Template Literal, ` TemplateStringsArray ` , ` required `
82
+
83
+ ** Return**
84
+
85
+ - Interpolations, ` (string | function)[] `
86
+
87
+ ** Usage**
88
+
89
+ ``` vue
90
+
91
+ <script setup lang="ts">
92
+ import { styled, css } from '@vue3-styled-components/package'
93
+
94
+ const mixin = css`
95
+ color: red;
96
+ background-color: blue;
97
+ `
98
+ const DivWithStyles = styled('div')`
99
+ ${mixin}
100
+ `
101
+ </script>
102
+
103
+ <template>
104
+ <DivWithStyles>Div with mixin</DivWithStyles>
105
+ </template>
106
+ ```
107
+
73
108
## ` withAttrs `
74
109
75
110
A function to add attributes to a ` ComponentInstance ` or ` HTMLElements ` .
111
+
76
112
** Augments**
77
113
78
114
- Component or Html Tag, ` ComponentInstance | SupportedHTMLElements ` , ` required `
@@ -85,16 +121,17 @@ A function to add attributes to a `ComponentInstance` or `HTMLElements`.
85
121
** Usage**
86
122
87
123
``` vue
124
+
88
125
<script setup lang="ts">
89
- import { withAttrs } from '@vue3-styled-components/package'
126
+ import { withAttrs } from '@vue3-styled-components/package'
90
127
91
- const DivWithAttrs = withAttrs('div', {
92
- class: 'div-with-attrs'
93
- })
128
+ const DivWithAttrs = withAttrs('div', {
129
+ class: 'div-with-attrs'
130
+ })
94
131
95
- const DivWithAttrs2 = withAttrs(DivWithAttrs, {
96
- class: 'div-with-attrs-2'
97
- })
132
+ const DivWithAttrs2 = withAttrs(DivWithAttrs, {
133
+ class: 'div-with-attrs-2'
134
+ })
98
135
</script>
99
136
100
137
<template>
@@ -103,12 +140,12 @@ const DivWithAttrs2 = withAttrs(DivWithAttrs, {
103
140
</template>
104
141
105
142
<style scope>
106
- .div-with-attrs {
107
- color: red;
108
- }
143
+ .div-with-attrs {
144
+ color: red;
145
+ }
109
146
110
- .div-with-attrs-2 {
111
- color: blue;
112
- }
147
+ .div-with-attrs-2 {
148
+ color: blue;
149
+ }
113
150
</style>
114
151
```
0 commit comments