If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote } from "@chakra-ui/react"
const Demo = () => {
return (
<Blockquote.Root>
<Blockquote.Content>
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride in
himself, without comparing himself to anyone else.
</Blockquote.Content>
</Blockquote.Root>
)
}
Usage
import { Blockquote } from "@chakra-ui/react"
<Blockquote.Root>
<Blockquote.Content cite="https://" />
<Blockquote.Caption>
<cite>Uzumaki Naruto</cite>
</Blockquote.Caption>
</Blockquote.Root>
Examples
With Cite
To provide reference about the blockquote:
- pass the
cite
prop toBlockquote.Content
pointing to the quote url - render the
Blockquote.Caption
component to display name of quote author
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote } from "@chakra-ui/react"
const Demo = () => {
return (
<Blockquote.Root>
<Blockquote.Content cite="Uzumaki Naruto">
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride in
himself, without comparing himself to anyone else.
</Blockquote.Content>
<Blockquote.Caption>
— <cite>Uzumaki Naruto</cite>
</Blockquote.Caption>
</Blockquote.Root>
)
}
Colors
Use the colorPalette
prop to change the color of the blockquote.
gray
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
red
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
green
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
blue
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
teal
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
pink
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
purple
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
cyan
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
orange
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
yellow
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote, Stack, Text } from "@chakra-ui/react"
import { colorPalettes } from "compositions/lib/color-palettes"
const Demo = () => {
return (
<Stack gap="5" align="flex-start">
{colorPalettes.map((colorPalette) => (
<Stack
align="center"
key={colorPalette}
direction="row"
gap="10"
px="4"
width="full"
>
<Text minW="8ch">{colorPalette}</Text>
<Blockquote.Root colorPalette={colorPalette}>
<Blockquote.Content cite="Uzumaki Naruto">
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take
pride in himself, without comparing himself to anyone else.
</Blockquote.Content>
<Blockquote.Caption>
— <cite>Uzumaki Naruto</cite>
</Blockquote.Caption>
</Blockquote.Root>
</Stack>
))}
</Stack>
)
}
Variants
Use the variant
prop to change the visual style of the blockquote.
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote, Stack } from "@chakra-ui/react"
const Demo = () => {
return (
<Stack gap="8">
<Blockquote.Root variant="subtle">
<Blockquote.Content>
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride
in himself, without comparing himself to anyone else.
</Blockquote.Content>
</Blockquote.Root>
<Blockquote.Root variant="solid">
<Blockquote.Content>
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride
in himself, without comparing himself to anyone else.
</Blockquote.Content>
</Blockquote.Root>
</Stack>
)
}
Icon
Here's an example of how to compose the Float
and BlockquoteIcon
to show an
icon on the blockquote. The default icon is a double quote.
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote, Float } from "@chakra-ui/react"
const Demo = () => {
return (
<Blockquote.Root variant="plain" colorPalette="teal">
<Float placement="top-start" offsetY="2">
<Blockquote.Icon />
</Float>
<Blockquote.Content cite="Uzumaki Naruto">
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride in
himself, without comparing himself to anyone else.
</Blockquote.Content>
<Blockquote.Caption>
— <cite>Uzumaki Naruto</cite>
</Blockquote.Caption>
</Blockquote.Root>
)
}
Alternatively, you can render a custom icon.
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote, Circle, Float } from "@chakra-ui/react"
import { LuQuote } from "react-icons/lu"
const Demo = () => {
return (
<Blockquote.Root colorPalette="blue" ps="8">
<Float placement="middle-start">
<Circle bg="blue.600" size="8" color="white">
<LuQuote />
</Circle>
</Float>
<Blockquote.Content cite="Uzumaki Naruto">
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride in
himself, without comparing himself to anyone else.
</Blockquote.Content>
<Blockquote.Caption>
— <cite>Uzumaki Naruto</cite>
</Blockquote.Caption>
</Blockquote.Root>
)
}
Justify
Use the justify
prop to change the alignment of the blockquote.
start
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
center
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
end
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Blockquote, For, HStack, Stack, Text } from "@chakra-ui/react"
const Demo = () => {
return (
<Stack gap="20">
<For each={["start", "center", "end"]}>
{(justify) => (
<HStack key={justify} maxW="xl">
<Text color="fg.muted" minW="6rem">
{justify}
</Text>
<Blockquote.Root variant="plain" justify={justify}>
<Blockquote.Content cite="Uzumaki Naruto">
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take
pride in himself, without comparing himself to anyone else.
</Blockquote.Content>
<Blockquote.Caption>
— <cite>Uzumaki Naruto</cite>
</Blockquote.Caption>
</Blockquote.Root>
</HStack>
)}
</For>
</Stack>
)
}
With Avatar
Here's an example of how to compose the Blockquote
, Avatar
and Float
components to create a stunning testimonial component.
If anyone thinks he is something when he is nothing, he deceives himself. Each one should test his own actions. Then he can take pride in himself, without comparing himself to anyone else.
import { Avatar, Blockquote, Float, HStack, Span } from "@chakra-ui/react"
const Demo = () => {
return (
<Blockquote.Root bg="bg.subtle" padding="8">
<Float placement="bottom-end" offset="10">
<Blockquote.Icon opacity="0.4" boxSize="10" rotate="180deg" />
</Float>
<Blockquote.Content cite="Uzumaki Naruto">
If anyone thinks he is something when he is nothing, he deceives
himself. Each one should test his own actions. Then he can take pride in
himself, without comparing himself to anyone else.
</Blockquote.Content>
<Blockquote.Caption>
<cite>
<HStack mt="2" gap="3">
<Avatar.Root size="sm">
<Avatar.Fallback name="Emily Jones" />
<Avatar.Image src="https://i.pravatar.cc/150?u=re" />
</Avatar.Root>
<Span fontWeight="medium">Emily Jones</Span>
</HStack>
</cite>
</Blockquote.Caption>
</Blockquote.Root>
)
}
Closed Component
Here's an example of how to create a closed component composition
import { Blockquote as ChakraBlockquote } from "@chakra-ui/react"
import * as React from "react"
export interface BlockquoteProps extends ChakraBlockquote.RootProps {
cite?: React.ReactNode
citeUrl?: string
icon?: React.ReactNode
showDash?: boolean
}
export const Blockquote = React.forwardRef<HTMLDivElement, BlockquoteProps>(
function Blockquote(props, ref) {
const { children, cite, citeUrl, showDash, icon, ...rest } = props
return (
<ChakraBlockquote.Root ref={ref} {...rest}>
{icon}
<ChakraBlockquote.Content cite={citeUrl}>
{children}
</ChakraBlockquote.Content>
{cite && (
<ChakraBlockquote.Caption>
{showDash ? <>—</> : null} <cite>{cite}</cite>
</ChakraBlockquote.Caption>
)}
</ChakraBlockquote.Root>
)
},
)
export const BlockquoteIcon = ChakraBlockquote.Icon
Props
Root
Prop | Default | Type |
---|---|---|
colorPalette | 'gray' | 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent' The color palette of the component |
justify | 'start' | 'start' | 'center' | 'end' The justify of the component |
variant | 'subtle' | 'subtle' | 'solid' The variant of the component |