---
{
title: 'Examples',
description: 'Internal guidelines: writing example template files for NVIDIA Elements components, including naming conventions and stateless HTML patterns.',
layout: 'docs.11ty.js'
}
---
# {{ title }}
Examples are stateless HTML templates demonstrating UI patterns for the Elements design system. Well defined examples are critical for providing a portable documentation format for the CLI, MCP, and documentation site. This document provides guidance on creating well-written example templates. (`*.examples.ts`).
## Core Principles
### Example Title
The example title name should be no more than three words. This name references the function and renders in API/Documentation endpoints.
#### Naming Format
- **Use PascalCase** for all example names (for example, `Default`, `StatusFlat`, `FormSubmit`)
- Names should describe **what** the example shows, not **how** it works; explain how in the summary.
#### Single-Word Names
Use single words for basic API features and properties:
| Pattern | Examples |
| ------------------- | -------------------------------------------------- |
| Default/basic usage | `Default` |
| API properties | `Status`, `Size`, `Color`, `Position`, `Alignment` |
| Container variants | `Flat`, `Inline` |
| States | `Pressed`, `Selected`, `Disabled` |
| Slots/content | `Content`, `Actions` |
| Features | `Closable`, `Events`, `Overflow` |
#### Compound Names (2-3 words)
Use compound PascalCase for combinations or specific features and patterns:
| Pattern | Examples |
| ------------------ | ---------------------------------------------- |
| Property + variant | `StatusFlat`, `StatusIcon`, `SelectedFlat` |
| Feature + modifier | `OpenDelay`, `DynamicTrigger`, `ScrollContent` |
| Concept + variant | `GroupStatus`, `FormSubmit`, `FormControl` |
| Layout variants | `VerticalTabs`, `BorderlessTabs` |
#### Special Prefixes
| Prefix | Usage | Examples |
| --------- | ------------------------------------------------ | ---------------------------------------- |
| `Legacy` | Deprecated patterns | `LegacyTrigger`, `LegacyBehaviorTrigger` |
| `Invalid` | Anti-patterns | `InvalidLinkButton` |
| `Valid` | Correct patterns (when contrasting with invalid) | `ValidLinkButton` |
#### What to Avoid
- ❌ **Component names in titles**: Use `Status` not `BadgeStatus`
- ❌ **Implementation details**: Use `ScrollContent` not `OverflowAutoScrollContent`
- ❌ **Vague names**: Use `DynamicTrigger` not `Example1`
- ❌ **Overly long names**: Keep to 3 words max
#### Examples
```typescript
// ✅ Good: Clear, semantic names
export const Default = { /* ... */ };
export const Status = { /* ... */ };
export const StatusFlat = { /* ... */ };
export const FormSubmit = { /* ... */ };
// ❌ Bad: Component name in title
export const BadgeDefault = { /* ... */ };
export const BadgeStatus = { /* ... */ };
// ❌ Bad: Too verbose or unclear
export const Example1 = { /* ... */ };
export const TestCase = { /* ... */ };
export const DefaultBadgeWithStatusColors = { /* ... */ };
```
When the build produces examples for API consumption, it automatically attaches extra metadata such as the associated element/component reference and a UUID to ensure each example has a unique identifier across all projects.
### Use `@summary` JSDoc Comments
Every example **must** include a `@summary` JSDoc comment that explains:
- Descriptions must be concise one or two sentences only.
- **What** the example demonstrates
- **Why** this pattern is useful
- **When** to use this approach
- **How** it improves the user experience
**When appropriate use NVIDIA or NVIDIA Autonomous Vehicle program for UX use cases**
```typescript
/**
* @summary Basic badge component with default styling. Use for simple non-interactive labels or status indicators.
*/
export const Default = {
render: () => html`