This repository was archived by the owner on Mar 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path+page.svelte
More file actions
179 lines (178 loc) · 5.3 KB
/
Copy path+page.svelte
File metadata and controls
179 lines (178 loc) · 5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<script lang="ts">
import Card from "$lib/card/Card.svelte";
import Snippet from "$lib/snippet/Snippet.svelte";
import Spacer from "$lib/spacer/Spacer.svelte";
import Text from "$lib/text/Text.svelte";
import Note from "$lib/note/Note.svelte";
import LightSwitch from "$lib/lightswitch/LightSwitch.svelte";
import Playground from "$lib/docs-components/playground/playground.svelte";
</script>
<Text type="h3">Text</Text>
<Spacer h={10} />
<Text>Displays non-interactive text.</Text>
<Spacer h={20} />
<Snippet width="450px" type="transparent" text={`import { Text } from 'geist-ui-svelte';`} />
<Spacer h={30} />
<Text type="h4">Type</Text>
<Spacer h={5} />
<Text>
Thanks to <code>{`<svelte:element>`}</code> the text component renders with different html tags.
</Text>
<Spacer h={10} />
<Playground
code={`<Text type="h1">Text</Text>
<Text type="h2">Text</Text>
<Text type="h3">Text</Text>
<Text type="h4">Text</Text>
<Text type="h5">Text</Text>
<Text type="h6">Text</Text>
<Text>Text</Text>
<Text type="span">Text</Text>
<Text type="small">Text</Text>`}
>
<Text type="h1">Text</Text>
<Text type="h2">Text</Text>
<Text type="h3">Text</Text>
<Text type="h4">Text</Text>
<Text type="h5">Text</Text>
<Text type="h6">Text</Text>
<Text>Text</Text>
<Text type="span">Text</Text>
<Text type="small">Text</Text>
</Playground>
<Spacer h={30} />
<Text type="h4">Colors</Text>
<Spacer h={5} />
<Text>Text elements can come in a few different colors.</Text>
<Spacer h={10} />
<Playground
code={`<Text color="inherit">Text</Text>
<Text color="secondary">Text</Text>
<Text color="success">Text</Text>
<Text color="error">Text</Text>
<Text color="warning">Text</Text>
<Text color="abort">Text</Text>`}
>
<Text color="inherit">Text</Text>
<Text color="secondary">Text</Text>
<Text color="success">Text</Text>
<Text color="error">Text</Text>
<Text color="warning">Text</Text>
<Text color="abort">Text</Text>
</Playground>
<Spacer h={30} />
<Text type="h4">Default Size</Text>
<Spacer h={5} />
<Text>
The text component has a default font size of inherit for <code>`p`</code> and
<code>`span`</code> types. It also has a default font weight of inherit.
</Text>
<Spacer h={10} />
<Playground
code={`<Text type="h5" b>geist-<Text>ui</Text>-svelte</Text>
<Text type="h5" b>geist-<Text type="span">ui</Text>-svelte</Text>`}
>
<Text type="h5" b>geist-<Text>ui</Text>-svelte</Text>
<Text type="h5" b>geist-<Text type="span">ui</Text>-svelte</Text>
</Playground>
<Spacer h={30} />
<Text type="h4">Default Color</Text>
<Spacer h={5} />
<Text>
The Text component has a text color of <code>`inherit`</code> this means it will take its
container's
<code>`text-color`</code> value. Because of this it is best practice to include the following classes
somewhere higher in the DOM tree.
</Text>
<Spacer h={10} />
<Snippet
width="500px"
type="transparent"
text={'class="text-gray-999 dark:text-gray-0"'}
symbol=""
/>
<Spacer h={10} />
<Text>
This enables setting the text color from the container which can be useful when dealing with a
container with a solid color background that doesn't change between light and dark mode. If
you'd like to keep your text white on black and black on white you can use the color
<code>`dark`</code>.
</Text>
<Spacer h={20} />
<Note color="success">
Notice how when you set the text color to <code>`dark`</code> it breaks the layout in light mode.
</Note>
<Spacer h={20} />
<Text>Put your sunglasses on for this part 🕶️.</Text>
<Spacer h={10} />
<Playground
code={`<Card color="success">
<Text>Success</Text>
</Card>
<Card color="success">
<Text color="dark">Success</Text>
</Card>`}
>
<div class="flex place-items-center gap-2">
<Card color="success">
<Text>Success</Text>
</Card>
<Card color="success">
<Text color="dark">Success</Text>
</Card>
<LightSwitch />
</div>
</Playground>
<Spacer h={30} />
<Text type="h4">Blockquote</Text>
<Spacer h={10} />
<Playground code={`<Text blockquote>The best text is less text</Text>`}>
<Text blockquote>The best text is less text</Text>
</Playground>
<Spacer h={30} />
<Text type="h4">Additional Attributes</Text>
<Spacer h={5} />
<Text>
You can use <code>`b`</code> for bold, <code>`i`</code> for italics, <code>`del`</code> for line
through, and <code>`serif`</code> for your serif font style.
</Text>
<Spacer h={10} />
<Playground
code={`<Text>
<Text b color="abort" serif>geist</Text>
<Text color="success">-</Text>
<Text color="warning" i>ui</Text>
<Text color="success">-</Text>
<Text color="error" del>svelte</Text>
</Text>`}
>
<Text>
<Text b color="abort" serif>geist</Text>
<Text color="success">-</Text>
<Text color="warning" i>ui</Text>
<Text color="success">-</Text>
<Text color="error" del>svelte</Text>
</Text>
</Playground>
<Spacer h={30} />
<Text type="h4">Responsive Sizing</Text>
<Spacer h={5} />
<Text>
There are times you will need to resize your text for smaller screens. Instead of rendering a
different tag which is not accessible and changes the meaning of your page. Use responsive size
attributes <code>`size`, `smSize`, `mdSize`, `lgSize`</code>. Try it out by opening your dev
tools and resizing the screen.
</Text>
<Spacer h={10} />
<Playground
code={`<Text
type="h1"
size="2xl"
smSize="4xl"
mdSize="6xl"
lgSize="9xl">
geist-ui-svelte
</Text>`}
>
<Text type="h1" size="2xl" smSize="4xl" mdSize="6xl" lgSize="9xl">geist-ui-svelte</Text>
</Playground>