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

heading-component #43

Merged
merged 3 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/heading/BasicHeading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<c-heading>I'm a Heading</c-heading>
</template>

<script setup>
import { CHeading } from '@chakra-ui/vue-next';
</script>
16 changes: 16 additions & 0 deletions components/content/examples/heading/CompositionHeading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<c-box max-w="32rem">
<c-heading mb="4">Modern online and offline payments for Africa</c-heading>
<c-text font-size="xl">
Paystack helps businesses in Africa get paid by anyone, anywhere in the
world
</c-text>
<c-button size="lg" variant-color="green" mt="24px">
Create a free account
</c-button>
</c-box>
</template>

<script setup>
import { CBox, CText, CButton, CHeading } from '@chakra-ui/vue-next';
</script>
9 changes: 9 additions & 0 deletions components/content/examples/heading/OverrideHeading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<c-heading size="lg" fontSize="50px">
I'm overriding this heading
</c-heading>
</template>

<script setup>
import { CHeading } from '@chakra-ui/vue-next';
</script>
26 changes: 26 additions & 0 deletions components/content/examples/heading/SizesHeading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<c-stack spacing="3">
<c-heading as="h1" size="2xl">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h2" size="xl">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h3" size="lg">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h4" size="md">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h5" size="sm">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h6" size="xs">
In love with Vue & Nuxt
</c-heading>
</c-stack>
</template>

<script setup>
import { CStack, CHeading } from '@chakra-ui/vue-next';
</script>
9 changes: 9 additions & 0 deletions components/content/examples/heading/TruncatedHeading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<c-heading is-truncated>
Basic text writing, including headings, body text, lists, and more.
</c-heading>
</template>

<script setup>
import { CHeading } from '@chakra-ui/vue-next';
</script>
109 changes: 109 additions & 0 deletions content/4.components/heading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: Heading
description: Heading component
version: 2.0+
---

# Heading

Headings are used for rendering semantic HTML heading elements.

Heading composes `CBox` so you can use all the style props and add responsive styles as well. It renders an `<h2>` tag by default.

## Imports

```js
import { CHeading } from '@chakra-ui/vue-next';
```

## Usage

::showcase
:basic-heading
::


```html
<c-heading>I'm a Heading</c-heading>
```

### Changing font size

To increase the size of the heading, you can use the `font-size` or `size` prop. If you use the `size` prop, the font size of the heading will automatically decrease in size for smaller screens.

::showcase
:sizes-heading
::

```html
<c-stack spacing="3">
<c-heading as="h1" size="2xl">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h2" size="xl">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h3" size="lg">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h4" size="md">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h5" size="sm">
In love with Vue & Nuxt
</c-heading>
<c-heading as="h6" size="xs">
In love with Vue & Nuxt
</c-heading>
</c-stack>
```

### Truncate heading

Pass the `is-truncated` prop to render an ellipsis when the headings exceed

::showcase
:truncated-heading
::

```html
<c-heading is-truncated>
Basic text writing, including headings, body text, lists, and more.
</c-heading>
```

### Override style

You can override the size of the Heading component by passing the `font-size` prop.

::showcase
:override-heading
::

## Composition

::showcase
:composition-heading
::

```html
<c-box max-w="32rem">
<c-heading mb="4">Modern online and offline payments for Africa</c-heading>
<c-text font-size="xl">
Paystack helps businesses in Africa get paid by anyone, anywhere in the
world
</c-text>
<c-button size="lg" variant-color="green" mt="24px">
Create a free account
</c-button>
</c-box>
```

## Props

> The `CHeading` composes the `CBox` component. So it accepts all Box props along with the related CSS grid props. See Box component for list of props.

| Name | Values | Default | Description |
|--------|-------------------------------------|---------|--------------------------|
| `size` | `2xl`, `xl`, `lg`, `md`, `sm`, `xs` | `xl` | The size of the heading. |
| `as` | `h1`, `h2`, `h3`, `h4`, `h5`, `h6` | `h2` | The final tag rendered. |