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

Code component #41

Merged
merged 5 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
7 changes: 7 additions & 0 deletions components/content/examples/code/ColorsCode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<CStack is-inline>
<CCode>console.log(welcome)</CCode>
<CCode color-scheme="red">var chakra = 'awesome!'</CCode>
<CCode color-scheme="yellow">npm install chakra</CCode>
</CStack>
</template>
3 changes: 3 additions & 0 deletions components/content/examples/code/SimpleCode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<CCode> Hello world </CCode>
</template>
7 changes: 7 additions & 0 deletions components/content/examples/code/VariantCode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<CStack is-inline>
<CCode color-scheme="whatsapp" variant="outline">Outline </CCode>
<CCode color-scheme="whatsapp" variant="subtle">Solid </CCode>
<CCode color-scheme="whatsapp" variant="solid">Solid</CCode>
</CStack>
</template>
69 changes: 69 additions & 0 deletions content/4.components/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Code
description: Code component
version: 2.0+
---
# Code

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.

## Import

```js
import { CCode } from "@chakra-ui/vue-next"
```

## Usage

::showcase
:simple-code
::

```html
<CCode>Hello world </CCode>
```

## Colors

You can change the color scheme of the component by passing the `colorScheme` prop.

::showcase
:colors-code
::

```html
<CStack is-inline>
<CCode>console.log(welcome)</CCode>
<CCode color-scheme="red">var chakra = 'awesome!'></CCode>
<CCode color-scheme="yellow">npm install chakra</CCode>
</CStack>
```

## Variant

You can change the variant of the component by passing the `variant` prop.

::showcase
:variant-code
::

```html
<CStack is-inline>
<CCode color-scheme="whatsapp" variant="outline">Outline </CCode>
<CCode color-scheme="whatsapp" variant="subtle">Solid </CCode>
<CCode color-scheme="whatsapp" variant="solid">Solid</CCode>
</CStack>
```

## Props

| Name | Type | Default | Description |
|---------------|------------------------------------|----------|---------------------------------------|
| `colorScheme` | `string` | `grey` | The color scheme to use for the code. |
| `variant` | `"solid" \| "subtle" \| "outline"` | `subtle` | The variant of the Code |

## Slots

| Name | Description |
|---------------|---------------------------------------|
| `default` | Used for the `CCode` content. |