Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 6950fa3

Browse files
committed
docs: add getting-started
1 parent b0737a4 commit 6950fa3

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

docs/.vitepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function getSetupSidebar() {
4040
text: 'Introduction',
4141
children: [
4242
{ text: 'Chakra UI Vue', link: '/' },
43-
{ text: 'Getting Started', link: '/guide/getting-started' }
43+
{ text: 'Getting Started', link: '/guides/getting-started' }
4444
]
4545
},
4646
{

docs/guides/getting-started.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Getting Started
3+
description: How to install and set up Chakra UI in your project
4+
version: 1.0+
5+
---
6+
7+
8+
# Installation
9+
10+
Using Chakra UI Vue in your Vue.js project is very simple. Install the package and its dependencies.
11+
12+
```bash
13+
yarn add @chakra-ui/vue-next
14+
```
15+
16+
## Usage
17+
18+
Before you can use Chakra, you have to add it to the Vue.js instance. This will be done in your `main.ts` file.
19+
20+
```jsx
21+
import { createApp } from 'vue'
22+
import App from './App.vue'
23+
import ChakraUIVuePlugin from '@chakra-ui/vue-next'
24+
25+
const app = createApp(App).use(ChakraUIVuePlugin)
26+
app.mount('#app')
27+
```
28+
29+
## Using Chakra Components
30+
31+
When you can use a Chakra UI Vue component, you will first have to import the Chakra component you want to use, for example, the `CButton`.
32+
33+
```jsx
34+
import { CButton } from "@chakra-ui/vue-next"
35+
```
36+
37+
Next, you have to add it to the components option.
38+
39+
```jsx
40+
export default defineComponent({
41+
name: 'YOUR COMPONENT NAME',
42+
components: {
43+
CButton
44+
}
45+
})
46+
```
47+
48+
You are now able to use it in the template.
49+
50+
```html
51+
<c-button variant-color="green">Button</c-button>
52+
```
53+
54+
### C-Reset
55+
56+
Sometimes you may need to apply css reset styles to your application. Chakra UI exports a `CReset` that'll remove browser default styles. It's heavily inspired by `Tailwind's preflight`.
57+
58+
> 🚨 We highly recommend that you add the `CReset` at the root of your application to ensure all components work correctly.
59+
60+
```jsx
61+
import { CReset } from "@chakra-ui/vue-next"
62+
```
63+
64+
And at the root level template add the following
65+
66+
```html
67+
<c-reset />
68+
```

0 commit comments

Comments
 (0)