### Install Project Dependencies Source: https://github.com/hashicorp/design-system/blob/main/packages/components/CONTRIBUTING.md Clones the repository and installs project dependencies using pnpm. Assumes git and pnpm are installed. ```bash git clone pnpm install cd packages/components ``` -------------------------------- ### Install Design System Tokens Source: https://github.com/hashicorp/design-system/blob/main/packages/tokens/README.md Installs the @hashicorp/design-system-tokens package using pnpm. This package contains design tokens for the Helios Design System. ```bash pnpm add @hashicorp/design-system-tokens ``` -------------------------------- ### Install Helios Design System Packages Source: https://context7.com/hashicorp/design-system/llms.txt Commands to install the core design system components and tokens using the pnpm package manager. ```bash pnpm add @hashicorp/design-system-components pnpm add @hashicorp/design-system-tokens ``` -------------------------------- ### Run Showcase Application Source: https://github.com/hashicorp/design-system/blob/main/packages/components/CONTRIBUTING.md Starts the showcase application locally. The application will be available at http://localhost:4200. ```bash cd showcase pnpm start ``` -------------------------------- ### Install Design System Components Source: https://github.com/hashicorp/design-system/blob/main/website/docs/getting-started/for-engineers/index.md Installs the HashiCorp Design System components package using npm. This package includes components, design tokens, and CSS helper classes. ```bash npm install @hashicorp/design-system-components ``` -------------------------------- ### Install Helios Design System Components Source: https://github.com/hashicorp/design-system/blob/main/packages/components/README.md Installs the core design system component package using the pnpm package manager. ```bash pnpm add @hashicorp/design-system-components ``` -------------------------------- ### Install and Run Verdaccio Local Registry Source: https://github.com/hashicorp/design-system/blob/main/packages/tokens/RELEASE.md Commands to install Verdaccio globally, launch the service, and add a user to the local npm registry for testing package releases without affecting the production registry. ```bash npm install -g verdaccio verdaccio npm adduser --registry http://localhost:4873 ``` -------------------------------- ### Compose Toast with Icons and Actions Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/toast/partials/content/content.md Examples of various Toast configurations including icons, titles, descriptions, and action buttons. ```handlebars With icon and title Toast with actions Lorem ipsum dolar sit amet, consectetur adi. ``` -------------------------------- ### Standalone Link Trailing Icon Examples Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/link/standalone/partials/guidelines/guidelines.md Demonstrates the use of trailing icons with the Standalone Link, typically used for guiding users forward or when no other meaningful icon is available. Includes examples for internal, tutorial, documentation, and external links. ```HTML ``` -------------------------------- ### Implement Basic Stepper Component Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/stepper/list/partials/code/how-to-use.md Demonstrates the fundamental setup of a Stepper list component. It requires defining individual steps within the parent container. ```handlebars <:step> <:title>Step 1 <:step> <:title>Step 2 ``` -------------------------------- ### Basic Invocation of PopoverPrimitive Source: https://github.com/hashicorp/design-system/blob/main/website/docs/utilities/popover-primitive/partials/code/how-to-use.md Demonstrates the basic setup of the PopoverPrimitive using three modifiers: setupPrimitiveContainer, setupPrimitiveToggle, and setupPrimitivePopover applied to elements. ```html
Popover Content
``` -------------------------------- ### Standalone Link Leading Icon Examples Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/link/standalone/partials/guidelines/guidelines.md Provides examples of using a leading icon with the Standalone Link. This is generally preferred for clarity and directionality, especially for actions like 'Download' or navigating backward. ```HTML ``` -------------------------------- ### Alert Component Examples (Glimmer) Source: https://context7.com/hashicorp/design-system/llms.txt Demonstrates the usage of the HdsAlert component for displaying various types of feedback messages. Supports different types (inline, page, compact), colors, icons, titles, descriptions, and action buttons. Includes examples for dismissible alerts and alerts with custom actions. ```gts import Component from '@glimmer/component'; import { on } from '@ember/modifier'; import { HdsAlert } from '@hashicorp/design-system-components/components'; export default class AlertExamples extends Component { handleDismiss = () => { console.log('Alert dismissed'); }; handleAction = () => { console.log('Action clicked'); }; } ``` -------------------------------- ### Icon Color Configuration Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/icon/partials/code/how-to-use.md Examples of setting icon colors using foreground variables, CSS tokens, or standard CSS color strings. ```handlebars ``` -------------------------------- ### Toast with Generic Content Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/toast/partials/content/content.md This example demonstrates how to use the Hds::Toast component with custom, generic content passed via the `T.Generic` slot. ```APIDOC ## Toast with Generic Content ### Description This example shows how to render a success toast message with a custom title, description, and additional generic content using the `T.Generic` contextual component. ### Method N/A (Component Usage) ### Endpoint N/A (Component Usage) ### Parameters #### Component Properties - **@color** (string) - Optional - The color theme of the toast (e.g., "success", "warning", "danger"). Defaults to "info". - **@icon** (string) - Optional - The icon to display in the toast. Uses `check-circle` in this example. - **@onDismiss** (function) - Optional - Callback function to execute when the toast is dismissed. #### Slots - **Default Slot**: Contains the main content of the toast, including `T.Title`, `T.Description`, and `T.Generic`. - **T.Title**: Slot for the toast's title. - **T.Description**: Slot for the main descriptive text of the toast. - **T.Generic**: Slot for any additional, custom content. ### Request Example ```html Toast with extra/custom content In special cases, you can pass extra content to the Toast using the A.Generic contextual component. ``` ### Response #### Success Response (200) N/A (Component Rendering) #### Response Example N/A (Component Rendering) ``` -------------------------------- ### Flexbox Layout with Placeholders Source: https://github.com/hashicorp/design-system/blob/main/website/docs/layouts/flex/partials/code/how-to-use.md An example showing how to use the Layout::Flex component with generic content placeholders to create equally sized flex items. ```Handlebars {{#> Layout::Flex}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{/ Layout::Flex}} ``` -------------------------------- ### Handlebars template transformation example Source: https://github.com/hashicorp/design-system/blob/main/packages/codemods/transforms/v4/contextual-components/README.md Demonstrates the input and output of the codemod, showing how nested component references like A.Link::Standalone are flattened to A.LinkStandalone. ```handlebars Label ``` ```handlebars Label ``` -------------------------------- ### Breadcrumb with Truncation Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/breadcrumb/partials/guidelines/guidelines.md Demonstrates how to implement truncation for breadcrumbs when space is limited. This example shows a basic truncation setup. ```html ``` -------------------------------- ### Build Project and Watch Files Source: https://github.com/hashicorp/design-system/blob/main/packages/components/CONTRIBUTING.md Builds the project using pnpm. The 'start' command also sets up a watcher to automatically rebuild on file changes in the 'src' directory. ```bash pnpm build pnpm start ``` -------------------------------- ### Install Ember CLI Sass Dependency Source: https://github.com/hashicorp/design-system/blob/main/packages/components/README.md Installs the ember-cli-sass addon required for processing the design system's SCSS files. ```bash ember install ember-cli-sass ``` -------------------------------- ### Using the Icon Component Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/icon/index.md Demonstrates how to import and use the Icon component in your application. This typically involves importing the component and rendering it with appropriate props. ```javascript import { Icon } from "@hashicorp/design-system"; function MyComponent() { return ( ); } ``` -------------------------------- ### Implement HdsTabs for Content Navigation Source: https://context7.com/hashicorp/design-system/llms.txt Shows how to use the HdsTabs component for organizing content into panels. Includes examples for sizing, pre-selected tabs, icons, counts, and controlled state management. ```gts import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { HdsTabs } from '@hashicorp/design-system-components/components'; export default class TabsExample extends Component { @tracked selectedTabIndex = 0; handleTabClick = (event: Event, tabIndex: number) => { this.selectedTabIndex = tabIndex; }; } ``` -------------------------------- ### How to Use Layout::Grid Component Source: https://github.com/hashicorp/design-system/blob/main/website/docs/layouts/grid/index.md Demonstrates the basic usage of the Layout::Grid component for content organization. This snippet shows how to import and apply the grid component in your project. It serves as a starting point for implementing grid-based layouts. ```html

This section includes code examples for using the Layout::Grid component. Please refer to the 'how-to-use.md' partial for specific implementation details.

``` -------------------------------- ### Handlebars SideNav Input Example Source: https://github.com/hashicorp/design-system/blob/main/packages/codemods/transforms/v3/side-nav/README.md Example of the input Handlebars code for Hds::SideNav::List and Hds::SideNav::Portal components before the codemod is applied. ```handlebars ... ... ... ... ... ... ``` -------------------------------- ### How to use Numbered Pagination (Basic) Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/pagination/partials/code/how-to-use.md Demonstrates the basic invocation of the Numbered Pagination component with essential arguments. ```APIDOC ## How to use Numbered Pagination ### Basic Invocation Requires the `@totalItems` argument. Event/routing handlers can also be provided. ```ruby <%= pagination( totalItems: @total_items, # other arguments... ) %> ``` By default, `Info` and `SizeSelector` sub-components are displayed and managed automatically. ``` -------------------------------- ### Handlebars SideNav Output Example Source: https://github.com/hashicorp/design-system/blob/main/packages/codemods/transforms/v3/side-nav/README.md Example of the output Handlebars code for Hds::SideNav::List and Hds::SideNav::Portal components after the codemod has been applied, showing updated casing for extraBefore/extraAfter. ```handlebars ... ... ... ... ... ... ``` -------------------------------- ### Basic Icon Implementation Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/icon/partials/code/how-to-use.md Demonstrates the simplest way to invoke the Icon component by providing a name property. ```handlebars ``` -------------------------------- ### Basic AppFrame Implementation Source: https://github.com/hashicorp/design-system/blob/main/website/docs/layouts/app-frame/partials/code/how-to-use.md Demonstrates the most basic invocation of the AppFrame component to create a standard application layout structure. ```handlebars {{#app-frame as |f|}} {{f.header}} {{f.sidebar}} {{f.main}} {{f.footer}} {{/app-frame}} ``` -------------------------------- ### Inline Link Component Usage (HTML/Ember) Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/link/inline/partials/content/content.md Demonstrates the correct and incorrect usage of an inline link component. The 'Do' example shows highlighting a key phrase, while the 'Don't' example illustrates wrapping an entire sentence, which is discouraged. ```HTML Learn more about deploying a Vault Cluster on HCP in the HashiCorp Developer tutorial library. ``` ```HTML Learn more about deploying a Vault Cluster on HCP in the HashiCorp Developer tutorial library. ``` -------------------------------- ### Inverse Button Group Example (Ember) Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/button/partials/guidelines/guidelines.md Shows an example of using Button and ButtonSet components for an inverse button group, where a secondary button with a link appearance is part of the group. This is an appropriate use case for links styled as buttons. ```htmlbars ``` -------------------------------- ### Using Stepper Nav with Contextual Components Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/stepper/nav/partials/code/how-to-use.md Demonstrates how to use Hds::Stepper::Nav::Step and Hds::Stepper::Nav::Panel as yielded contextual components to build a stepper flow. ```handlebars Content for step 1 Content for step 2 ``` -------------------------------- ### Icon Component Examples (Glimmer) Source: https://context7.com/hashicorp/design-system/llms.txt Illustrates the use of the HdsIcon component for rendering SVG icons from the Flight icon library. Supports customization of icon name, size, color, and display properties like inline or stretched. Includes examples for static and animated loading icons. ```gts import type { TemplateOnlyComponent } from '@ember/component/template-only'; import { HdsIcon } from '@hashicorp/design-system-components/components'; const IconExamples: TemplateOnlyComponent = ; export default IconExamples; ``` -------------------------------- ### Implement Base File Input Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/form/file-input/partials/code/how-to-use.md Shows the minimal configuration for the Base component, intended for custom layout requirements. ```handlebars ``` -------------------------------- ### Glimmer Component for Form Checkbox Examples Source: https://context7.com/hashicorp/design-system/llms.txt This Glimmer component demonstrates various use cases for the HdsFormCheckboxField and HdsFormCheckboxGroup components. It includes examples for single checkboxes with labels and helper text, pre-checked checkboxes, checkbox groups with different layouts (vertical and horizontal), and checkbox groups with validation. ```gts import Component from '@glimmer/component'; import { on } from '@ember/modifier'; import { HdsFormCheckboxGroup, HdsFormCheckboxField } from '@hashicorp/design-system-components/components'; export default class CheckboxExample extends Component { handleChange = (event: Event) => { console.log('Checked:', (event.target as HTMLInputElement).checked); }; } ``` -------------------------------- ### Pagination Component Example in GTS Source: https://context7.com/hashicorp/design-system/llms.txt Demonstrates the usage of the Pagination component for navigating through paginated data. Supports numbered and compact variants, custom page sizes, and callbacks for page and page size changes. Requires '@glimmer/component' and '@hashicorp/design-system-components/components'. ```gts import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { HdsPaginationNumbered, HdsPaginationCompact } from '@hashicorp/design-system-components/components'; export default class PaginationExample extends Component { @tracked currentPage = 1; @tracked pageSize = 10; handlePageChange = (page: number) => { this.currentPage = page; console.log('Page changed to:', page); }; handlePageSizeChange = (size: number) => { this.pageSize = size; console.log('Page size changed to:', size); }; handleCompactChange = (page: number) => { console.log('Compact pagination:', page); }; } ``` -------------------------------- ### Radio Card with Nested Badges Example Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/form/radio-card/partials/guidelines/guidelines.md Demonstrates the usage of the Hds::Form::RadioCard::Group component to create radio cards. Each card can contain a label, one or more badges for additional information, and a generic content area for more details. This example shows two distinct radio card configurations. ```Ember Cluster type HCP-managed Consul
  • Connect workloads in your cloud provider network with HCP
  • Offload Consul operations to Hashicorp Experts
Self-managed Consul
  • Multi-cloud artifact registry
  • Golden images workflow
  • Terraform Cloud integration
  • 10 free images/month
  • 250 free requests/month
``` -------------------------------- ### Form Text Input Component Examples (Glimmer) Source: https://context7.com/hashicorp/design-system/llms.txt Demonstrates various configurations of the Form TextInput component, including basic usage, helper text, pre-filled values, required/optional fields, email validation, password fields, character counts, and custom widths. It utilizes Glimmer components from the HashiCorp Design System. ```gts import Component from '@glimmer/component'; import { on } from '@ember/modifier'; import { tracked } from '@glimmer/tracking'; import { HdsFormTextInputField } from '@hashicorp/design-system-components/components'; export default class TextInputExample extends Component { @tracked email = ''; @tracked isInvalid = false; handleInput = (event: Event) => { this.email = (event.target as HTMLInputElement).value; this.isInvalid = !this.email.includes('@'); }; } ``` -------------------------------- ### Basic Breadcrumb Implementation Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/breadcrumb/partials/code/how-to-use.md Demonstrates the fundamental usage of the Breadcrumb component. This example shows how to render a simple breadcrumb trail without advanced features like routing or truncation. ```html Home Features Documentation ``` -------------------------------- ### Handling Tab Click Events Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/tabs/partials/code/how-to-use.md Provides an example of using the @onClickTab handler to trigger custom logic, such as updating URL parameters. ```handlebars {{#tabs onClickTab=(action "handleTabClick")}} {{#tab title="Tab 1"}}Content{{/tab}} {{/tabs}} ``` -------------------------------- ### Implement Basic Grid Layout Source: https://github.com/hashicorp/design-system/blob/main/website/docs/layouts/grid/partials/code/how-to-use.md Demonstrates the simplest implementation of the Layout::Grid component where children are stretched to fit evenly within column tracks. ```handlebars
Item 1
Item 2
Item 3
``` -------------------------------- ### Stepper::Task::Indicator - Basic Usage Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/stepper/indicator/partials/code/how-to-use.md Provides a basic example of the Stepper::Task::Indicator component, which requires a `status` argument. ```APIDOC ## Stepper::Task::Indicator - Basic Usage ### Description Provides a basic example of how to use the Stepper::Task::Indicator component. ### Method N/A (Component Usage) ### Endpoint N/A (Component Usage) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ``` {{code-snippets/stepper-task-indicator-basic}} ``` ### Response #### Success Response (200) N/A (Component Usage) #### Response Example N/A ``` -------------------------------- ### Customizing AppFooter Layout Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/app-footer/partials/code/how-to-use.md Provides an example of applying custom styles to the extra content areas to override the default inline layout. ```jsx ``` -------------------------------- ### Align Source: https://github.com/hashicorp/design-system/blob/main/website/docs/layouts/grid/partials/code/how-to-use.md Use the `@align` argument to control the alignment of grid items within the grid parent (start, end, center, stretch). ```APIDOC ## Align Use the `@align` argument to align grid items to the "start", "end", "center" or "stretch" them within the grid parent. Note: The `Grid` parent will need a height set for the effect to be visible. [[code-snippets/grid-align]] ``` -------------------------------- ### Contextual Components: [S].Step and [S].Panel Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/stepper/nav/partials/code/component-api.md Detailed documentation for the sub-components yielded by Stepper::Nav. ```APIDOC ## COMPONENT [S].Step ### Description Used within Stepper::Nav to define the visual representation of a specific step. ### Named Blocks - **<:title>** (required) - Block for rendering the step title. - **<:description>** (optional) - Block for rendering the step description. --- ## COMPONENT [S].Panel ### Description Used within Stepper::Nav to define the content panel for a specific step. ### Yield - **content** - Elements passed as children are rendered inside a
element. ``` -------------------------------- ### Render Hds::Button component Source: https://github.com/hashicorp/design-system/blob/main/website/docs/testing/markdown/more-complex-code.md Shows how to implement the Hds::Button component using Handlebars syntax. Includes an example with execution disabled. ```handlebars ``` ```handlebars ``` -------------------------------- ### App Side Nav - How to Use Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/app-side-nav/index.md Provides guidance on how to integrate the App Side Nav component into your application. ```APIDOC ## How to Use App Side Nav This section details the steps and best practices for implementing the App Side Nav component. ### Installation Refer to the main design system installation guide for package details. ### Basic Usage ```jsx ``` ### Advanced Usage Customization options and advanced features will be detailed here, including: - Nested navigation items - Active item highlighting - Custom icons ``` -------------------------------- ### Flexbox Spacing with Single Gap Value Source: https://github.com/hashicorp/design-system/blob/main/website/docs/layouts/flex/partials/code/how-to-use.md Example of using the `@gap` argument in Layout::Flex to set a uniform spacing between all flex items. ```Handlebars {{#> Layout::Flex @gap="24px"}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{#> Layout::Flex::Item}} {{#> Card}} {{#> Card::Body}} Content {{/ Card::Body}} {{/ Card}} {{/ Layout::Flex::Item}} {{/ Layout::Flex}} ``` -------------------------------- ### Basic Compact Pagination Usage Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/pagination/partials/code/how-to-use.md Illustrates the basic invocation of the Compact Pagination component, which displays only 'prev' and 'next' navigation controls by default. No specific arguments are required for basic functionality. ```html ``` -------------------------------- ### Handle Selection Changes with Callback Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/table/advanced-table/partials/code/how-to-use.md An example of an action handler for the onSelectionChange callback, which receives selection metadata and the list of currently selected keys. ```javascript @action demoOnSelectionChange({ selectionKey, selectionCheckboxElement, selectableRowsStates, selectedRowsKeys }) { selectedRowsKeys.forEach((rowSelectionKey) => { // do something using the row’s selectionKey value }); } ``` -------------------------------- ### How to Use Time Component Source: https://github.com/hashicorp/design-system/blob/main/website/docs/components/time/index.md Demonstrates the basic usage of the Time component. This snippet shows how to import and render the component in your application. It typically takes date/time values as props. ```javascript import { Time } from "@hashicorp/design-system"; function App() { return (