Skip to content

Commit 82e2168

Browse files
committed
chore: typos and adds FormKit Pro key instructions
1 parent 750d1f6 commit 82e2168

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

guides/create-a-tailwind-theme.md

+32-16
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Let's explore how we can create a Tailwind theme — with configurable options
4646

4747
## Creating a configurable FormKit theme
4848

49-
By following the instructions below we will create a theme like the ones available at [https://themes.formkit.com](https://themes.formkit.com). This includes support for variable configuration options if you as a theme author want to provide them.
49+
By following the instructions below we will create a theme like the ones available at [https://themes.formkit.com](https://themes.formkit.com). This includes support for user-configurable variables if you choose to provide them.
5050

5151
::ArticleCard
5252
---
@@ -57,19 +57,29 @@ href: "https://themes.formkit.com"
5757
---
5858
::
5959

60-
Better yet, once your theme is complete — if you provided styling for every available FormKit input — you can submit your theme to be included on [https://themes.formkit.com](https://themes.formkit.com) by [opening a PR](https://github.com/formkit/themes.formkit.com/pulls) against the site repo. Once approved it will become available for anyone else to use in their project via the CLI or web UI.
60+
Once your theme is complete you can submit your theme to be included on [https://themes.formkit.com](https://themes.formkit.com) by [opening a PR](https://github.com/formkit/themes.formkit.com/pulls) against the site repo. Once approved it will become available for anyone else to use in their project via the CLI or web UI.
6161

6262
### Initialize a copy of the starter theme
6363

64-
FormKit provides a starter theme — which comes with structural styles and plentiful comments — that is intended to help new authors get started quickly creating their own FormKit themes. To get started, run the following command in your terminal:
64+
FormKit provides a starter theme — which comes with structural styles and plentiful comments — that is intended to help new authors cerate their own themes.
65+
66+
To get started, run the following command in your terminal:
6567

6668
```bash
6769
npx formkit create-theme
6870
```
6971

70-
This will download a copy of the starter theme in the directory where you run the command. The starter theme is a fully functional Vite application that includes a "Kitchen Sink" to help you see how your theme applies to every available input in every available input state as you work.
72+
This will download a clean copy of the starter theme for you to work off of. The starter theme is a fully functional Vite application that includes a "Kitchen Sink" to help you see how your classes affect every available FormKit input.
73+
74+
Next, you will need to log in at [https://pro.formkit.com](https://pro.formkit.com) and create a new (free) development key for FormKit Pro. This key will allow you to render the FormKit Pro elements that are included in the Kitchen Sink.
75+
76+
Add your FormKit Pro key to a `.env` file in the root of your project
77+
78+
```
79+
FORMKIT_PRO_KEY=fk-**********
80+
```
7181

72-
To begin work on your theme run:
82+
Once you've added your pro key, run the following commands to begin work on your theme:
7383

7484
```bash
7585
# or npm or yarn
@@ -93,7 +103,7 @@ The remaining files in the starter theme can be ignored (but not removed) as the
93103

94104
### Working with variables
95105

96-
Variables are a powerful way to share values across your theme and to optionally allow theme users to customize your theme to their liking. Variables are used in your inputs' class lists via the following syntax:
106+
Variables are a powerful way to re-use values across your theme and to allow theme users to customize your theme to their liking. Variables are used in your inputs' class lists via the following syntax:
97107

98108
```js
99109
// global.ts
@@ -116,7 +126,13 @@ The following variables are defined for convenience in the starter theme but do
116126
- `colorTemperatureStrengthDark`
117127
- `inputMaxWidth`
118128

119-
You can create your own variables in this fashion by providing a new key/value pair in the variables object:
129+
The starter theme also ships with the following variables that expose UI controls for theme users:
130+
131+
- `radius`,
132+
- `spacing`,
133+
- `scale`
134+
135+
You can create your own basic non-user-configurable variables by providing a new key/value pair in the variables object:
120136

121137
```js
122138
export default createTheme({
@@ -191,9 +207,9 @@ To do this we provide an `editor` value for our variable. The `editor` determine
191207
- `spacing`: A slider with a range of values with depictions of tighter spacing at the beginning and wider spacing at the end. By default includes a scale from `0` to `96`.
192208
- `select`: A standard HTML select list that can contain any number of values. Theme authors must provided their own scale.
193209

194-
You can see an example of each of these editor values by looking at the `Regenesis` theme [here](https://themes.formkit.com/editor?theme=regenesis).
210+
You can see an example of each of these editor values by viewing the editor UI for the `Regenesis` theme [here](https://themes.formkit.com/editor?theme=regenesis).
195211

196-
We can update our `spacing` variable to use an appropriate editor.
212+
We can update our `spacing` variable to use an appropriate editor:
197213

198214
```js
199215
spacing: {
@@ -202,7 +218,7 @@ spacing: {
202218
}
203219
```
204220

205-
Now when we run our theme locally we will see a new control in the theme editor for our `spacing` variable with a slider that allows us to go from `0` to `96` as we step through the default Tailwind scale.
221+
Now we will see a new control in the theme editor for our `spacing` variable with a slider that allows us to go from `0` to `96` as we step through the default Tailwind scale.
206222

207223
::Callout
208224
---
@@ -214,7 +230,7 @@ When you expose a variable to a theme user they are changing the base value when
214230

215231
### Setting min and max for user-controlled variables
216232

217-
In most cases it makes sense to constrain the available scale for a user defined variable. Allowing our users to adjust `spacing` is great, but we probably don't want them to be able to crank the value all the way up to `96` or all the way down to `0`. We can constrain the range of the scale that is available to a user by using the `min` and `max` properties on our variable.
233+
In most cases it makes sense to constrain the available scale for a user-configurable variable. Allowing our users to adjust `spacing` is great, but we probably don't want them to be able to crank the value all the way up to `96` or all the way down to `0`. We can constrain the range of the scale that is available to a user by using the `min` and `max` properties on our variable.
218234

219235
```js
220236
spacing: {
@@ -229,7 +245,7 @@ This means that our `spacing` variable will now only allow values `1`, `1.5`, `2
229245

230246
### Creating one-off min and max constraints
231247

232-
Sometimes as a theme author you need to clamp or expand available values beyond what is defined in a variable's default scale. You can do this by passing additional `min` and `max` arguments to a particular instance of a variable in a class list.
248+
Sometimes as a theme author you need to clamp or expand available values beyond what is defined in a variable's default min and max definition. You can do this by passing additional `min` and `max` arguments to inline instances of a variable.
233249

234250
The provided values for `min` and `max` _must_ be values or the variables associated scale — whether that is a default scale for an editor or a custom scale defined by the theme author.
235251

@@ -254,14 +270,14 @@ export default {
254270

255271
### Overriding default editor scales
256272

257-
Some `editor` types such as `scale` or `color` come with default scales. However, we can still include a custom `scale` property of our own and override which options are available in the UI.
273+
Some `editor` types such as `scale` or `color` come with default scales. However, we can override the defaults by providing a custom `scale` property.
258274

259275
```js
260276
accentColor: {
261277
editor: "color",
262278
value: "blue",
263279
// excludes all "gray" colors
264-
// included in the default scale
280+
// from the default scale
265281
scale: [
266282
"red",
267283
"orange",
@@ -309,10 +325,10 @@ scale: {
309325
},
310326
```
311327

312-
## Publishing your theme
313-
314328
There are many more comments in the `@formkit/theme-starter` theme itself to help you along your way as you work.
315329

330+
## Publishing your theme
331+
316332
When you're done creating your theme you can use the included publishing script to build and publish your theme to npm.
317333

318334
First, ensure that you have modified the contents of your theme's `meta` key and `package.json` file to accurate reflect your theme's name, description, version, and author information.

0 commit comments

Comments
 (0)