Concepts
OverviewCompositionTestingLayout
Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrapComponents
AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltipUtilities
Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsThemeimport { Text } from '@cerberus/react'This is normal text
This is small textimport { Text } from '@cerberus/react'
function TextDemo() { return ( <> <Text as="h1" color="page.text.100" textStyle={{ base: 'heading-md', md: 'heading-lg', }} > Hello, world! </Text> <Text>This is normal text</Text> <Text as="small" color="info.text.100" textStyle="body-sm"> This is small text </Text> </> )}To render raw HTML, you can utilize the React dangerouslySetInnerHTML combined with the whiteSpace property.
This is a raw paragraph with a bold word and a
line break.
import { Text } from '@cerberus/react'
function DangerouslySetDemo() { const rawHTML = '<p>This is a raw paragraph with a <strong>bold</strong> word and a <br /> line break.</p>'
return ( <Text dangerouslySetInnerHTML={{ __html: rawHTML, }} textStyle="body-sm" whiteSpace="pre-wrap" /> )}export type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'export type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'
export interface TextProps extends BoxProps { as?: TextElements | Headings}
define function Text(props: TextProps): ReactNodeThe Text component accepts the following props along with the props from the Box component.
| Name | Default | Description |
|---|---|---|
| as | The text-based element to render the component as. |
On this page