### Basic PopoverPrimitive Invocation
Source: https://helios.hashicorp.design/utilities/popover-primitive
Demonstrates the fundamental setup of the PopoverPrimitive using three essential modifiers: setupPrimitiveContainer, setupPrimitiveToggle, and setupPrimitivePopover. This example shows how to associate a toggle button with a popover content area within a container.
```html
popover content
```
```handlebars
popover content
```
--------------------------------
### Install @hashicorp/design-system-tokens
Source: https://helios.hashicorp.design/getting-started/for-engineers
Installs the design tokens package using pnpm. This package provides design tokens that can be used to maintain consistent styling across applications.
```bash
pnpm add @hashicorp/design-system-tokens
```
--------------------------------
### Integration Example: Table with Pagination::Compact
Source: https://helios.hashicorp.design/components/pagination?demoCurrentCursor=cHJldl9fNg%3D%3D&demoCurrentPage=8&demoCurrentPageSize=5&demoExtraParam=hello&preserveScrollPosition=true
An example demonstrating the integration of the `Hds::Table` component with `Hds::Pagination::Compact`, where pagination state is managed via URL query parameters.
```APIDOC
## Hds::Table with Hds::Pagination::Compact Integration
### Description
This example showcases how to use the `Hds::Table` component alongside `Hds::Pagination::Compact`, with the pagination state being controlled by URL query parameters. The `Hds::Pagination::Compact` component is configured with routing parameters, ensuring that page changes update the URL and the table data reflects the current URL state.
### Method
N/A (Component Integration)
### Endpoint
N/A (Component Integration)
### Parameters
#### Table Component Arguments
- **@model** (array) - Required - The data to be displayed in the table.
- **@columns** (array) - Required - Defines the columns of the table, including key and label.
#### Pagination Component Arguments (as shown previously)
- **@route** (string) - Required - The name of the route.
- **@queryFunction** (function) - Required - Function to get current query parameters.
- **@isDisabledPrev** (boolean) - Optional - Disables the previous button.
- **@isDisabledNext** (boolean) - Optional - Disables the next button.
### Request Example
```html
<:body as |B|>
{{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
```
### Response
N/A (Component Integration)
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### Basic Dialog Example
Source: https://helios.hashicorp.design/utilities/dialog-primitive?tab=code
Example of how to create a basic dialog using DialogPrimitive components.
```APIDOC
## Basic dialog using DialogPrimitive components
### Description
Demonstrates the composition of a dialog using its primitive parts.
### Method
N/A (Component Usage Example)
### Endpoint
N/A (Component Usage Example)
### Parameters
N/A
### Request Example
```html
Dialog TitleThis is the dialog description.Content of the dialog goes here.
```
### Response
N/A
```
--------------------------------
### Install Design System Components (pnpm)
Source: https://helios.hashicorp.design/getting-started/for-engineers
Installs the HashiCorp design system components package using the pnpm package manager. This is the first step to using the components in your project.
```bash
pnpm add @hashicorp/design-system-components
```
--------------------------------
### Table and Pagination Integration Example
Source: https://helios.hashicorp.design/components/pagination?demoCurrentCursor=bmV4dF9fMjE%3D&demoCurrentPage=4&demoCurrentPageSize=5&demoExtraParam=hello&preserveScrollPosition=true
An example showcasing the integration of the `Hds::Table` component with `Hds::Pagination::Compact`, utilizing query parameters in the URL to maintain UI state.
```APIDOC
## Table and Pagination Integration
### Description
This example demonstrates a practical integration of the `Hds::Table` component with the `Hds::Pagination::Compact` component. It shows how to use URL query parameters to persist the UI state, such as the current page and sorting, between user interactions.
### Method
Component Integration
### Endpoint
N/A (Component Usage)
### Parameters
#### Table Component Arguments
- **@model** (array) - Required - The data model for the table.
- **@columns** (array of objects) - Required - Defines the columns for the table, each with a `key` and `label`.
#### Pagination Component Arguments
- **@route** (string) - Required - The route name for pagination links.
- **@queryFunction** (function) - Required - Function to get current query parameters.
- **@isDisabledPrev** (boolean) - Optional - Disables the previous button.
- **@isDisabledNext** (boolean) - Optional - Disables the next button.
### Request Example
```handlebars
<:body as |B|>
{{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
```
### Response
#### Behavior
- The table displays paginated data.
- The pagination component updates the URL query parameters when page navigation occurs.
- User actions on pagination are reflected in the URL, allowing for state persistence.
```
--------------------------------
### Table and Pagination Integration with URL State (.hbs, .js, .gts)
Source: https://helios.hashicorp.design/components/pagination?demoCurrentCursor=cHJldl9fMjE%3D&demoCurrentPage=1&demoCurrentPageSize=5&demoExtraParam=hello&preserveScrollPosition=true
An example showcasing the integration of the Hds::Table and Hds::Pagination::Compact components. This setup uses URL query parameters to preserve the UI state of the table and pagination, demonstrating a controlled component pattern where external code manages the state.
```handlebars
<:body as |B|> {{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
<:body as |B|>
{{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
```
--------------------------------
### Table and Pagination::Compact Integration Example
Source: https://helios.hashicorp.design/components/pagination?demoCurrentPage=2&demoCurrentPageSize=5&preserveScrollPosition=true
This example shows a practical integration of the Hds::Table component with Hds::Pagination::Compact, where the pagination component uses URL query parameters to maintain the table's state.
```APIDOC
## Table and Pagination::Compact Integration Example
### Description
This example illustrates how to integrate the `Hds::Table` component with the `Hds::Pagination::Compact` component. The pagination component utilizes URL query parameters to preserve the UI state, ensuring that table data and pagination are synchronized with the URL.
### Method
N/A (Component Integration)
### Endpoint
N/A (Component Integration)
### Parameters
#### Table Component Arguments
- **@model** (array) - Required - The data model for the table.
- **@columns** (array) - Required - An array of column definitions for the table.
#### Pagination Component Arguments
- **@route** (string) - Required - The name of the route for URL updates.
- **@queryFunction** (function) - Required - Function to get current query parameters.
- **@isDisabledPrev** (boolean) - Optional - Disables the previous button.
- **@isDisabledNext** (boolean) - Optional - Disables the next button.
### Request Example
```handlebars
<:body as |B|>
{{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
```
### Response
N/A (Component Behavior)
### Notes
This setup ensures that when a user interacts with the pagination, the URL is updated, and conversely, if the URL is changed externally (e.g., by navigating back), the pagination and table will reflect the new state.
```
--------------------------------
### Integrated Table and Pagination Example
Source: https://helios.hashicorp.design/components/pagination?demoCurrentPage=8&demoCurrentPageSize=5&preserveScrollPosition=true
This example shows how to integrate the HDS::Table component with HDS::Pagination::Numbered, using URL query parameters to preserve UI state.
```APIDOC
## Integrated Table and Pagination
### Description
This example demonstrates a common use case where a sortable table is paired with a pagination component. The pagination component utilizes URL query parameters to maintain the state of both the table and pagination, ensuring a seamless user experience.
### Method
N/A (Component Integration)
### Endpoint
N/A (Component Integration)
### Parameters
See individual component documentation for `@model`, `@columns`, `@density` for `Hds::Table` and the pagination arguments listed previously.
### Request Example
```handlebars
<:body as |B|>
{{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
```
### Response
N/A (Component Integration)
### Notes
- The `@density` argument for `Hds::Table` dynamically adjusts based on the selected page size.
- The `queryFunction` is crucial for defining how pagination state maps to URL query parameters.
```
--------------------------------
### Table and Pagination Integration Example
Source: https://helios.hashicorp.design/components/pagination?demoCurrentCursor=bmV4dF9fMjE%3D&demoCurrentPage=2&demoCurrentPageSize=5&demoExtraParam=hello&preserveScrollPosition=true
This example demonstrates how to integrate the Hds::Table component with the Hds::Pagination::Numbered component, using URL query parameters to maintain the UI state.
```APIDOC
## Table and Pagination Integration
### Description
This example showcases a common use case where a sortable table is paired with a numbered pagination component. The pagination component is configured to use URL query parameters for state management, ensuring that the current page and items per page are reflected in the URL.
### Method
Component Integration (Client-side)
### Endpoint
N/A (Client-side integration)
### Parameters
This integration involves configuring both the `Hds::Table` and `Hds::Pagination::Numbered` components. Key parameters for pagination include:
#### Pagination Component Arguments (as detailed in the previous snippet):
- **@totalItems**, **@currentPage**, **@pageSizes**, **@currentPageSize**, **@route**, **@queryFunction**, **@onPageChange**, **@onPageSizeChange**
#### Table Component Arguments (relevant for context):
- **@model**: The data to be displayed in the table.
- **@columns**: Configuration for table columns, including sorting capabilities.
- **@density**: Controls the table's density (e.g., 'short', 'medium').
### Request Example
```handlebars
<:body as |B|>
{{B.data.id}}{{B.data.name}}{{B.data.email}}{{B.data.role}}
```
### Response
N/A (Client-side integration)
### Error Handling
Ensure that the `@route` or other routing arguments are correctly passed to the pagination component if URL state management is desired. The table's data (`@model`) should be dynamically updated based on the pagination state.
```
--------------------------------
### Install and Use HDS Icons
Source: https://helios.hashicorp.design/getting-started/for-engineers
Provides the command to install the HDS components package and demonstrates the syntax for rendering an icon component in Ember templates.
```Bash
pnpm add @hashicorp/design-system-components
```
```Handlebars
```
--------------------------------
### Dropdown Menu Example
Source: https://helios.hashicorp.design/components/dropdown?tab=accessibility
This example demonstrates how to use the Dropdown component to create a menu with a toggle button, title, description, interactive items, and a separator. It utilizes contextual components for flexibility.
```HBS
AddAdd MoreAdd Another Thing TooDelete
```
--------------------------------
### Table and Pagination Integration Example
Source: https://helios.hashicorp.design/components/pagination?demoCurrentCursor=cHJldl9fMjE%3D&demoCurrentPage=1&demoCurrentPageSize=5&demoExtraParam=hello&preserveScrollPosition=true
This example demonstrates how to integrate the Hds::Table component with the Hds::Pagination::Numbered component. It shows how to pass paginated data to the table and configure the pagination component to work with routing, updating the URL based on page and page size changes.
```APIDOC
## Integrating Hds::Table with Hds::Pagination::Numbered
### Description
This example showcases a common use case: displaying paginated data in an Hds::Table component, controlled by an Hds::Pagination::Numbered component. The pagination component is configured to use routing, meaning that changes in page number or items per page will update the URL's query parameters. The table receives its data from the paginated results.
### Method
Not Applicable (Component Integration)
### Endpoint
Not Applicable (Component Integration)
### Parameters
#### Hds::Table Arguments
- **@model** (Array) - Required - The data to be displayed in the table.
- **@columns** (Array