Skip to content

Commit 88e8a2c

Browse files
committed
docs(docs): add comprehensive tailwind css playground documentation
1 parent 1d722a9 commit 88e8a2c

1 file changed

Lines changed: 98 additions & 1 deletion

File tree

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,100 @@
11
# Tailwind CSS
22

3-
TODO...
3+
import LiveCodes from '../../src/components/LiveCodes.tsx';
4+
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
5+
6+
export const basicDemo = {
7+
activeEditor: 'markup',
8+
markup: {
9+
language: 'html',
10+
content: `<div class="flex items-center justify-center h-screen bg-gray-100">\n <h1 class="text-4xl font-bold text-blue-500">Hello, Tailwind!</h1>\n</div>\n`,
11+
},
12+
processors: ['tailwindcss'],
13+
};
14+
15+
export const variantsDemo = {
16+
activeEditor: 'markup',
17+
markup: {
18+
language: 'html',
19+
content: `<div class="flex items-center justify-center h-screen">\n <button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 md:px-8 rounded">\n Hover me\n </button>\n</div>\n`,
20+
},
21+
processors: ['tailwindcss'],
22+
};
23+
24+
export const tailwindcssDemo = {
25+
activeEditor: 'script',
26+
script: {
27+
language: 'react',
28+
content: `export default function() {\n return <h1 className="text-3xl font-bold text-gray-500 text-center m-4">Hello, Tailwind CSS!</h1>;\n}\n`,
29+
},
30+
processors: ['tailwindcss'],
31+
};
32+
33+
[Tailwind CSS](https://tailwindcss.com/) is an open-source CSS framework that provides utility CSS classes that can be used to style each element by mixing and matching
34+
35+
## Demo
36+
37+
<LiveCodes template="tailwindcss" height="60vh"></LiveCodes>
38+
39+
## Usage
40+
41+
Tailwind CSS is enabled as a [CSS processor](../features/css.mdx#css-processors). Once enabled from the style editor menu, all Tailwind utility classes are available immediately in your markup.
42+
43+
:::info note
44+
45+
There is no need to add `@tailwind` directives to the style editor.
46+
LiveCodes automatically injects them when the Tailwind CSS processor is enabled.
47+
48+
:::
49+
50+
<RunInLiveCodes
51+
params={basicDemo}
52+
code={basicDemo.markup.content}
53+
language="html"
54+
formatCode={false}
55+
/>
56+
57+
### Usage with CSS Frameworks in JSX/SFCs
58+
59+
CSS Frameworks supported in LiveCodes (e.g. Tailwind CSS, [UnoCSS](./unocss.mdx), [WindiCSS](./windicss.mdx)) can detect class names added in JSX and framework SFCs such as [React](./react.mdx), [Vue](./vue.mdx) and [Svelte](./svelte.mdx). Make sure that the Tailwind CSS processor is enabled (from style editor menu or in [`processors`](../configuration/configuration-object.mdx#processors) property of [configuration object](../configuration/configuration-object.mdx)).
60+
61+
<RunInLiveCodes
62+
params={tailwindcssDemo}
63+
code={tailwindcssDemo.script.content}
64+
language="react"
65+
formatCode={false}
66+
/>
67+
68+
## Language Info
69+
70+
### Name
71+
72+
`tailwindcss`
73+
74+
### Extensions
75+
76+
`.css`
77+
78+
### Editor
79+
80+
`style`
81+
82+
## Compiler
83+
84+
[Tailwind CSS JIT compiler](https://tailwindcss.com/docs/just-in-time-mode), running client-side in the browser. The JIT compiler generates styles on-demand, so only the classes used in your markup are included in the output.
85+
86+
## Code Formatting
87+
88+
Using [Prettier](https://prettier.io/).
89+
90+
## Starter Template
91+
92+
https://livecodes.io/?template=tailwindcss
93+
94+
## Links
95+
96+
- [Tailwind CSS](https://tailwindcss.com/)
97+
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
98+
- [LiveCodes CSS Processors](../features/css.mdx#css-processors)
99+
- [UnoCSS](./unocss.mdx)
100+
- [WindiCSS](./windicss.mdx)

0 commit comments

Comments
 (0)