ID
A specialized component for displaying and formatting ID values with truncation, width control, and consistent styling for technical content.
Overview
The ID component provides a specialized way to display and format ID values throughout your application. It's designed to handle technical content like API keys, user IDs, or other identifier strings with consistent styling, truncation options, and width control for optimal display.
Usage
Examples
Value Truncation
Examples showing different truncation options for long ID values.
Width Control
Examples demonstrating width control for different display contexts.
Features
- Value Display: Consistent formatting for ID values
- Truncation Support: Optional truncation for long values
- Width Control: Configurable width for different display contexts
- Consistent Styling: Monospace font and consistent appearance
- Accessibility: Proper ARIA attributes and screen reader support
- Responsive Design: Adapts to different screen sizes
- Dark Mode Support: Consistent appearance in light and dark themes
Props
Prop | Type | Default | Description |
---|---|---|---|
value | string | Required | The ID value to display |
truncate | boolean | false | Whether to truncate long values |
width | string | - | CSS width class for the component |
className | string | - | Additional CSS classes |
Structure
The ID component is a simple, self-contained component that renders as a single span element with:
- Value Display - The main ID value with optional truncation
- Styling Container - Consistent styling and width control
- Accessibility Features - ARIA attributes and screen reader support
Styling
The component includes default styling with:
- Monospace font for consistent ID display
- Consistent padding and spacing
- Truncation with ellipsis for long values
- Dark mode support with appropriate color schemes
- Focus states for accessibility
- Customizable through className and width props
Custom Styling
You can customize the appearance using the className and width props:
Accessibility
The ID component is built with accessibility in mind:
- Semantic HTML: Uses appropriate HTML elements for ID display
- ARIA Attributes: Proper ARIA labels for screen readers
- Screen Reader Support: Announces ID values appropriately
- High Contrast: Maintains proper contrast ratios
- Focus Management: Clear focus indicators when interactive