Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center Component #44

Merged
merged 3 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions components/content/examples/center/IconCenter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<CHStack>
<CCenter w='40px' h='40px' bg='tomato' color='white'>
<CIcon name="phone" />
</CCenter>
<CCenter w='40px' h='40px' bg='tomato' color='white'>
<CBox as='span' fontWeight='bold' fontSize='lg'>
1
</CBox>
</CCenter>
</CHStack>
</template>

5 changes: 5 additions & 0 deletions components/content/examples/center/SimpleCenter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<CCenter bg='tomato' h='100px' color='white'>
This is the Center
</CCenter>
</template>
10 changes: 10 additions & 0 deletions components/content/examples/center/SquareAndCircle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<CHStack>
<CCircle size='40px' bg='teal.800' color='white'>
<CIcon name="phone" />
</CCircle>
<CSquare size='40px' bg='rebeccapurple' color='white'>
<CIcon name="phone" />
</CSquare>
</CHStack>
</template>
76 changes: 76 additions & 0 deletions content/4.components/center.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Center
description: Center Component
version: 2.0+
---

# Center

Center is a layout component that centers its child within itself.

## Import

```js
import { CCenter, CCircle, CSquare } from '@chakra-ui/vue-next';
```

- CCenter: centers its child given `width` and `height`
- CSquare: centers its child given `size` (width and height)
- CCircle: a Square with round `border-radius`

## Usage

Put any child element inside it, give it any `width` or/and `height`, it'll ensure the child is centered.

::showcase
::simple-center{width=full}
::
::

```html
<CCenter bg='tomato' h='100px' color='white'>
This is the Center
</CCenter>
```

## With Icons

CCenter can be used to create frames around icons or numbers.

::showcase
::icon-center
::
::

```html
<CHStack>
<CCenter w='40px' h='40px' bg='tomato' color='white'>
<CIcon name="phone" />
</CCenter>
<CCenter w='40px' h='40px' bg='tomato' color='white'>
<CBox as='span' fontWeight='bold' fontSize='lg'>
1
</CBox>
</CCenter>
</CHStack>
```

## Square and Circle

The Square and Circle components automatically centers its children given the size.

::showcase
::square-and-circle
::
::

```html
<CHStack>
<CCircle size='40px' bg='teal.800' color='white'>
<CIcon name="phone" />
</CCircle>
<CSquare size='40px' bg='rebeccapurple' color='white'>
<CIcon name="phone" />
</CSquare>
</CHStack>
```
6 changes: 2 additions & 4 deletions content/4.components/checkbox.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Checkbox
description:
Checkbox component is used in forms when a user needs to select multiple
values from several options.
description: Checkbox Component
version: 2.0+
---

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

```js
import { CCheckbox, CCheckboxGroup } from '@chakra-ui/vue'
import { CCheckbox, CCheckboxGroup } from '@chakra-ui/vue-next';
```

## Usage
Expand Down