Example Text
The Example Text component displays sample input or example values in a visually distinct style. Use Example Text to show users what they should type or to display example values in documentation.Installation
Usage
Props
ExampleText Props
| Prop | Type | Default | Description |
|---|---|---|---|
element | string | 'EXAMPLE_TEXT' | Overrides the default element name to apply unique styles with the Customization Provider. |
Styling Details
The Example Text component has the following default styles:- Renders as
<samp>(sample output) with an inner<kbd>(keyboard input) element display:inline-blockbackgroundColor:colorBackgroundfontFamily:fontFamilyTextfontWeight:fontWeightMediumfontSize:fontSize30lineHeight:lineHeight40borderRadius:borderRadius20paddingX:space30
Examples
Basic Example Text
Inline with Paragraph
Customization
The Example Text component can be customized using the Customization Provider:Customizable Elements
The following element names are available for customization:{element}_WRAPPER: The outer<samp>element{element}: The inner<kbd>element
element="EXAMPLE_TEXT" (the default):
EXAMPLE_TEXT_WRAPPER: Outer wrapperEXAMPLE_TEXT: Inner content
Use Cases
- Displaying example user input in forms
- Showing sample commands or keyboard shortcuts
- Demonstrating example values in documentation
- Highlighting placeholder text examples
- Showing API response examples
Semantic HTML
Example Text uses two semantic HTML elements:<samp>: Represents sample or quoted output from a computer program<kbd>: Represents user input from a keyboard or other input device
Accessibility
- Uses semantic HTML elements (
<samp>and<kbd>) for proper meaning - The background color provides visual distinction while maintaining readability
- Text remains selectable and copyable
- Works well with screen readers due to semantic markup