Callout
Display brief, crucial messages in a noticeable way.
The callout component attracts the user’s attention to provide extra information. Keystone provides this component as a partial (for template use) and as a shortcode (for Markdown content).
The component leverages the partial decorators(Opens in a new tab)
construct introduced in Hugo v0.154.0.
Reference
The component is composed of the ui/callout partial decorator and a child shortcode that simply calls the partial.
- icon
"icon" "pizza"— (string, optional)- The name of the icon to display. Use
"false"to disable the icon entirely. - Note: Requires the Icon component to be installed.
- title
"title" "Origin Story"— (string, optional)- The header text of the callout.
- type
"type" "default"— (string, optional)- Defines the visual style.
- Values:
default(default),error,info,question,success,warning
Installation
The Callout component is disabled by default to save resources.
Uncomment the import in the following file:
- The Get Started: Manual Installation steps must be completed!
- The Icon component
must be installed.
- For the default icons download the Callout Icon Pack
and extract it to
assets/icons/.
- For the default icons download the Callout Icon Pack
and extract it to
Hugo Partial
Create the ui/callout partial.
Hugo Shortcode
Create the shortcode.
CSS Styling
Create the CSS component:
Import it in your main Tailwind file:
Usage
Use the component to attract the user’s attention for crucial or important pieces of information.
Using the Partial (Templates)
When working inside layout files (e.g. layouts/home.html), use the with context pattern. This is required because the partial acts as a decorator:
Using the Shortcode (Markdown)
As shown in the examples, even when body content is not provided, you MUST close the tags:
- Partials: Use
{{ with ... }} {{ end }}. - Shortcodes: Use the closing tag
Tips & tricks
Semantic Roles
All types of callouts are designed to be static and use role="note". They should be considered part of the document flow.
Ensure the content text conveys the importance of the information, rather than relying solely on color.
Accessibility
The component is engineered to meet WCAG 2.2 guidelines:
- Contrast: The default color variants are designed to meet as minimum WCAG AA (4.5:1)(Opens in a new tab) contrast ratios.
- Screen Readers: Uses
role="note"to provide a semantic hint to assistive technology that this content is parenthetic or ancillary to the main content.