Heading - Chakra UI | Design System Built With React
Headings are used for rendering headlines.
Heading composes Box so you can use all the style props and add responsive styles as well. It renders an <h2> tag by default.
Import#
import { Heading } from "@chakra-ui/core";import{Heading}from"@chakra-ui/core";copyUsage#
I'm a Heading
<Heading>I'm a Heading</Heading><Heading>I'm a Heading</Heading>copyEditable ExampleChanging font size#
To increase the size of the heading, you can use the fontSize or size prop. If you use the size prop, the font size of the heading will automatically decrease in size for smaller screens.
In love with React & NextIn love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
<Stack spacing={3}> <Heading as="h1" size="2xl"> In love with React & Next </Heading> <Heading as="h2" size="xl"> In love with React & Next </Heading> <Heading as="h3" size="lg"> In love with React & Next </Heading> <Heading as="h4" size="md"> In love with React & Next </Heading> <Heading as="h5" size="sm"> In love with React & Next </Heading> <Heading as="h6" size="xs"> In love with React & Next </Heading> </Stack><Stackspacing={3}><Headingas="h1"size="2xl"> In love with React & Next</Heading><Headingas="h2"size="xl"> In love with React & Next</Heading><Headingas="h3"size="lg"> In love with React & Next</Heading><Headingas="h4"size="md"> In love with React & Next</Heading><Headingas="h5"size="sm"> In love with React & Next</Heading><Headingas="h6"size="xs"> In love with React & Next</Heading></Stack>copyEditable ExampleTruncate heading#
Pass the isTruncated prop to render an ellipsis when the headings exceeds
Basic text writing, including headings, body text, lists, and more.
<Heading isTruncated> Basic text writing, including headings, body text, lists, and more. </Heading><HeadingisTruncated> Basic text writing, including headings, body text, lists, and more.</Heading>copyEditable ExampleOverride style#
You can override the size of the Heading component by passing the fontSize prop. No need to write css or styled()
I'm overriding this heading
<Heading size="lg" fontSize="50px"> I'm overriding this heading </Heading><Headingsize="lg"fontSize="50px">I'm overriding this heading</Heading>copyEditable ExampleComposition#
Modern online and offline payments for Africa
Paystack helps businesses in Africa get paid by anyone, anywhere in the world
Create a free account// Example from paystack.com <Box maxW="32rem"> <Heading mb={4}>Modern online and offline payments for Africa</Heading> <Text fontSize="xl"> Paystack helps businesses in Africa get paid by anyone, anywhere in the world </Text> <Button size="lg" variantColor="green" mt="24px"> Create a free account </Button> </Box>// Example from paystack.com<BoxmaxW="32rem"><Headingmb={4}>Modern online and offline payments for Africa</Heading><TextfontSize="xl"> Paystack helps businesses in Africa get paid by anyone, anywhere in the world</Text><Buttonsize="lg"variantColor="green"mt="24px"> Create a free account</Button></Box>copyEditable ExampleProps#
The Heading composes the Box component, so you can pass all Box props.
| Name | Type | Default | Description |
|---|---|---|---|
| size | 2xl, xl , lg, md, sm, xs | xl | The size of the heading. |
Proudly made in 🇳🇬
Released under the MIT License.
Copyright © 2020 Segun Adebayo
Từ khóa » Chakra Ui H1
-
Heading - Chakra UI
-
Text And Layer Styles - Chakra UI
-
Text - Chakra UI
-
Chakra Factory
-
Global Styles - Chakra UI
-
Heading - Chakra UI
-
Chakra UI Prose
-
How Do I Preserve The Styling Of H2, H3, Etc? Problem ... - GitHub
-
Text Style Not Applying Unless Property Is Defined #3612 - GitHub
-
Chakra UI Test - StackBlitz
-
Advanced Techniques In Chakra UI - LogRocket Blog
-
Choc UI: Chakra UI Prebuilt Components
-
Unit Testing On NextJS + Chakra-UI Project - Stack Overflow
-
Chakra Ui Button Not Rendering - Stack Overflow