Skip to content

Commit 75ccf7b

Browse files
authored
Center Component (#44)
* feat: center component documentation * refactor: change name casing center * refactor: change name casing center
1 parent f2b23e8 commit 75ccf7b

File tree

5 files changed

+106
-4
lines changed

5 files changed

+106
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<CHStack>
3+
<CCenter w='40px' h='40px' bg='tomato' color='white'>
4+
<CIcon name="phone" />
5+
</CCenter>
6+
<CCenter w='40px' h='40px' bg='tomato' color='white'>
7+
<CBox as='span' fontWeight='bold' fontSize='lg'>
8+
1
9+
</CBox>
10+
</CCenter>
11+
</CHStack>
12+
</template>
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<CCenter bg='tomato' h='100px' color='white'>
3+
This is the Center
4+
</CCenter>
5+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<CHStack>
3+
<CCircle size='40px' bg='teal.800' color='white'>
4+
<CIcon name="phone" />
5+
</CCircle>
6+
<CSquare size='40px' bg='rebeccapurple' color='white'>
7+
<CIcon name="phone" />
8+
</CSquare>
9+
</CHStack>
10+
</template>

content/4.components/center.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Center
3+
description: Center Component
4+
version: 2.0+
5+
---
6+
7+
# Center
8+
9+
Center is a layout component that centers its child within itself.
10+
11+
## Import
12+
13+
```js
14+
import { CCenter, CCircle, CSquare } from '@chakra-ui/vue-next';
15+
```
16+
17+
- CCenter: centers its child given `width` and `height`
18+
- CSquare: centers its child given `size` (width and height)
19+
- CCircle: a Square with round `border-radius`
20+
21+
## Usage
22+
23+
Put any child element inside it, give it any `width` or/and `height`, it'll ensure the child is centered.
24+
25+
::showcase
26+
::simple-center{width=full}
27+
::
28+
::
29+
30+
```html
31+
<CCenter bg='tomato' h='100px' color='white'>
32+
This is the Center
33+
</CCenter>
34+
```
35+
36+
## With Icons
37+
38+
CCenter can be used to create frames around icons or numbers.
39+
40+
::showcase
41+
::icon-center
42+
::
43+
::
44+
45+
```html
46+
<CHStack>
47+
<CCenter w='40px' h='40px' bg='tomato' color='white'>
48+
<CIcon name="phone" />
49+
</CCenter>
50+
<CCenter w='40px' h='40px' bg='tomato' color='white'>
51+
<CBox as='span' fontWeight='bold' fontSize='lg'>
52+
1
53+
</CBox>
54+
</CCenter>
55+
</CHStack>
56+
```
57+
58+
## Square and Circle
59+
60+
The Square and Circle components automatically centers its children given the size.
61+
62+
::showcase
63+
::square-and-circle
64+
::
65+
::
66+
67+
```html
68+
<CHStack>
69+
<CCircle size='40px' bg='teal.800' color='white'>
70+
<CIcon name="phone" />
71+
</CCircle>
72+
<CSquare size='40px' bg='rebeccapurple' color='white'>
73+
<CIcon name="phone" />
74+
</CSquare>
75+
</CHStack>
76+
```

content/4.components/checkbox.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: Checkbox
3-
description:
4-
Checkbox component is used in forms when a user needs to select multiple
5-
values from several options.
3+
description: Checkbox Component
64
version: 2.0+
75
---
86

@@ -13,7 +11,7 @@ Checkbox component is used in forms when a user needs to select multiple values
1311
## Import
1412

1513
```js
16-
import { CCheckbox, CCheckboxGroup } from '@chakra-ui/vue'
14+
import { CCheckbox, CCheckboxGroup } from '@chakra-ui/vue-next';
1715
```
1816

1917
## Usage

0 commit comments

Comments
 (0)