Skip to main content

Highlight

A short, important message displayed inline and in context. Different from a Toast, which is global.

Polymorphic Component

By default, content is rendered inside a <div>, but this can be overriden by passing any valid tag name or component with the as prop.

Examples

Basic Highlight

A simple admonition used to callout a small amount of content. Available in two sizes.

import { Highlight } from '@curology/ui-components-web/react/Highlight';

<Highlight
size="{sm|md(default)}"
>
This is a simple highlight.
</Highlight>

With Title

Adding a title adds more weight to the highlight. The title can be combined with content.

import { Highlight } from '@curology/ui-components-web/react/Highlight';

<Highlight
...
title="Big Ol' Title"
>
...
</Highlight>

Composable Title

Similar to the child content, the title can be composed of JSX instead of a plain string

import { Highlight } from '@curology/ui-components-web/react/Highlight';
import { Progress } from '@curology/ui-components-web/react/Progress';
import { Typography } from '@curology/ui-components-web/react/Typography';

<Highlight title={<Progress />}>
<Typography>Some child content</Typography>
</Highlight>

<Highlight title={<Typography>Some title content</Typography>}>
<Progress />
</Highlight>

Highlight, Critical, Warning, and Success States

There are four states of the Highlight to add additional context to a message.

import { Highlight } from '@curology/ui-components-web/react/Highlight';

<Highlight
...
state="{highlight(default)|critical|warning|success}"
>
...
</Highlight>

With Icon

A trailing icon can be added for additional clarity.

import { Highlight } from '@curology/ui-components-web/react/Highlight';

<Highlight
...
icon={<PlaceholderIcon />}
>
...
</Highlight>

Props

HighlightProps

NameTypeDefault ValueRequiredDescription
All attributes of a <div />
iconComponentClass<any, any> | FunctionComponent<any> | ReactElement<any, string | JSXElementConstructor<any>> | ForwardRefExoticComponent<any>NoAn icon to render at the end of the highligh.
size"md" | "sm""md"NoThe size of the highlight.
state"dark" | "light" | "highlight" | "critical" | "warning" | "success""highlight"NoThe state of the highlight.
titleReactNodeNoA title to display before the content.