Skip to content

Commit 44c3ac2

Browse files
authored
Code component (#41)
* feat: code component documentation * refactor: change name casing code * refactor: change name casing code
1 parent 308c42e commit 44c3ac2

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<CStack is-inline>
3+
<CCode>console.log(welcome)</CCode>
4+
<CCode color-scheme="red">var chakra = 'awesome!'</CCode>
5+
<CCode color-scheme="yellow">npm install chakra</CCode>
6+
</CStack>
7+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<CCode> Hello world </CCode>
3+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<CStack is-inline>
3+
<CCode color-scheme="whatsapp" variant="outline">Outline </CCode>
4+
<CCode color-scheme="whatsapp" variant="subtle">Solid </CCode>
5+
<CCode color-scheme="whatsapp" variant="solid">Solid</CCode>
6+
</CStack>
7+
</template>

content/4.components/code.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Code
3+
description: Code component
4+
version: 2.0+
5+
---
6+
# Code
7+
8+
Code is a component used to display inline code. It is composed of the `Box` component with a font family of `mono` for displaying code.
9+
10+
## Import
11+
12+
```js
13+
import { CCode } from "@chakra-ui/vue-next"
14+
```
15+
16+
## Usage
17+
18+
::showcase
19+
:simple-code
20+
::
21+
22+
```html
23+
<CCode>Hello world </CCode>
24+
```
25+
26+
## Colors
27+
28+
You can change the color scheme of the component by passing the `colorScheme` prop.
29+
30+
::showcase
31+
:colors-code
32+
::
33+
34+
```html
35+
<CStack is-inline>
36+
<CCode>console.log(welcome)</CCode>
37+
<CCode color-scheme="red">var chakra = 'awesome!'></CCode>
38+
<CCode color-scheme="yellow">npm install chakra</CCode>
39+
</CStack>
40+
```
41+
42+
## Variant
43+
44+
You can change the variant of the component by passing the `variant` prop.
45+
46+
::showcase
47+
:variant-code
48+
::
49+
50+
```html
51+
<CStack is-inline>
52+
<CCode color-scheme="whatsapp" variant="outline">Outline </CCode>
53+
<CCode color-scheme="whatsapp" variant="subtle">Solid </CCode>
54+
<CCode color-scheme="whatsapp" variant="solid">Solid</CCode>
55+
</CStack>
56+
```
57+
58+
## Props
59+
60+
| Name | Type | Default | Description |
61+
|---------------|------------------------------------|----------|---------------------------------------|
62+
| `colorScheme` | `string` | `grey` | The color scheme to use for the code. |
63+
| `variant` | `"solid" \| "subtle" \| "outline"` | `subtle` | The variant of the Code |
64+
65+
## Slots
66+
67+
| Name | Description |
68+
|---------------|---------------------------------------|
69+
| `default` | Used for the `CCode` content. |

0 commit comments

Comments
 (0)