### Setup HModalProvider and Opener Component Source: https://design.holistics.dev/guides/modal-mechanism This snippet shows the basic setup for using the modal system. It wraps the `Opener` component within an `HModalProvider` to make the `useModal` composable available to its descendants. No external dependencies are required beyond the design system. ```vue ``` -------------------------------- ### HTag Component Theming Examples (Vue) Source: https://design.holistics.dev/components/tag Illustrates how to apply different themes to the HTag component using the 'theme' prop. This example iterates through a predefined array of theme names. Requires importing HTag from '@holistics/design-system'. ```vue ``` -------------------------------- ### Vue Script Setup for Avatar Component Metadata Source: https://design.holistics.dev/components/avatar This script setup defines the metadata for the Avatar component's props. It initializes an object `_meta` and populates its `props` array with detailed information for each prop, including name, type, requirement, default value, and description. ```vue ``` -------------------------------- ### Install Vue Router Source: https://design.holistics.dev/components/tree Installs the Vue Router package using npm, pnpm, or yarn. This is a prerequisite for using router links within the Tree component. ```shell npm add vue-router ``` ```shell pnpm add vue-router ``` ```shell yarn add vue-router ``` -------------------------------- ### Vue Tree Component - Basic Usage Example Source: https://design.holistics.dev/components/tree Demonstrates the basic structure and usage of the Tree component in Vue.js. It includes setting up the component with an array of nodes and shows how to handle events like node loading. ```vue ``` -------------------------------- ### Basic HBadge Usage in Vue Source: https://design.holistics.dev/components/badge Demonstrates the basic implementation of the HBadge component. It imports HBadge from the design system and renders a simple badge with the label 'Badge'. This serves as a starting point for using the component. ```vue ``` -------------------------------- ### Install TailwindCSS Preset via Package Managers Source: https://design.holistics.dev/guides/tailwindcss-preset Installs the `@holistics/configs` package, which provides a custom TailwindCSS preset. Supports npm, pnpm, and yarn package managers. ```shell npm add -D @holistics/configs ``` ```shell pnpm add -D @holistics/configs ``` ```shell yarn add -D @holistics/configs ``` -------------------------------- ### Vue.js Component Setup for Pass-through Div Source: https://design.holistics.dev/components/banner This Vue.js script setup defines the metadata for a pass-through component. It specifies the component's props, events, and slots, enabling flexible attribute and event handling. The `_meta` object holds the definitions that can be used to generate documentation tables. ```javascript const _meta = {} _meta.props = [ { "name": "type", "type": "\"info\" | \"success\" | \"warning\" | \"danger\" | \"neutral\"", "required": true, "description": "" }, { "name": "theme", "type": "\"inline\" | \"full-width\"", "required": false, "default": "\"inline\"", "description": "" }, { "name": "title", "type": "string", "required": false, "description": "" }, { "name": "description", "type": "string", "required": false, "description": "" }, { "name": "hideIcon", "type": "boolean", "required": false, "description": "" }, { "name": "dismissible", "type": "boolean", "required": false, "description": "" }, { "name": "dismissable", "type": "boolean", "required": false, "description": "" }, { "name": "button", "type": "string | ButtonPropsPreTyped", "required": false, "description": "" } ] _meta.events = [ { "name": "buttonClick", "type": "[e: MouseEvent]", "description": "" }, { "name": "dismiss", "type": "[]", "description": "" } ] _meta.slots = [ { "name": "header", "type": "any", "description": "" }, { "name": "default", "type": "any", "description": "" } ] ``` -------------------------------- ### HShortcut Component - Dark Theme Examples (Vue) Source: https://design.holistics.dev/components/shortcut Illustrates how to use the HShortcut component with a dark theme. It shows both the default and outlined versions of the shortcut in a dark background context. ```vue ``` -------------------------------- ### Switch Component with Size Variations (Vue) Source: https://design.holistics.dev/components/switch Illustrates how to use the HSwitch component with different size variants provided by the SWITCH_SIZES constant. This example iterates through available sizes and applies them to the switch. Requires Vue 3 and the @holistics/design-system library. ```vue ``` -------------------------------- ### Component Configuration (Vue.js) Source: https://design.holistics.dev/components/tag_list This script sets up metadata for a component, defining its properties, events, and slots. It utilizes Vue.js's ``` -------------------------------- ### Vue Radio Button: Default Example Source: https://design.holistics.dev/components/radio Demonstrates the default usage of the HRadio component in Vue.js. It shows how to bind a model value and iterate over options to render radio buttons. Dependencies include 'vue' and '@holistics/design-system'. ```vue ``` -------------------------------- ### Default Avatar Group Setup (Vue) Source: https://design.holistics.dev/components/avatar_group Demonstrates the basic implementation of the HAvatarGroup component. It requires an array of avatar information, including image URLs, names, or initials, and a size prop. This example shows how to import and use the component with sample avatar data. ```vue ``` -------------------------------- ### Vue Pagination Component - Default Usage Source: https://design.holistics.dev/components/pagination A Vue.js 3 script setup example demonstrating the default usage of the HPagination component. It shows how to import the component, manage the current page state using `ref`, and bind it to the pagination component with a total of 100 pages. ```vue ``` -------------------------------- ### Floating Component Props Source: https://design.holistics.dev/components/popover-onboarding Configuration options for the Floating component. ```APIDOC ## Props ### `popperSafeAreas` (boolean) **Description:** By default, `PopperSafeAreas` provided by the parent (if exists) will override any Hover Provider. Setting this to `true` will force Hover Provider to override the parent instead. ### `floatingTeleportTo` (string | RendererElement | null) **Description:** Specify target container. Can either be a selector or an actual element. See {@link https://vuejs.org/api/built-in-components.html#teleport}. ### `floatingTeleportDisabled` (boolean) **Description:** When `true`, the content will remain in its original location instead of moved into the target container. Can be changed dynamically. See {@link https://vuejs.org/api/built-in-components.html#teleport}. ### `floatingTeleportDefer` (boolean) **Description:** When `true`, the Teleport will defer until other parts of the application have been mounted before resolving its target. (3.5+). See {@link https://vuejs.org/api/built-in-components.html#teleport}. ### `floatingClass` (HTMLAttributeClass) **Description:** HTML `class` applied to the Floating element. ### `floatingStyle` (StyleValue) **Description:** HTML `style` applied to the Floating element. ### `contentAsChild` (boolean) **Description:** `asChild` prop but applied for the Content element (i.e. the direct element inside the inner Floating element). `asChild` prop: Change the default rendered element for the one passed as a child, merging their props and behavior. If there are multiple elements/components passed, only the first valid one will have the props. ### `title` (string) **Description:** (No description provided) ### `description` (string) **Description:** (No description provided) ### `leftButton` (string | ButtonPropsPreTyped) **Description:** (No description provided) ### `rightButton` (string | ButtonPropsPreTyped) **Description:** (No description provided) ### `stepText` (string) **Description:** (No description provided) ``` -------------------------------- ### Floating Component Exposed Methods Source: https://design.holistics.dev/components/popover-onboarding Methods exposed by the Floating component. ```APIDOC ## Exposed ### `popperRef` ({ $: ComponentInternalInstance; $data: {}; $props: { readonly open?: boolean | undefined; readonly trigger: PopperTrigger; readonly delay?: number | null | undefined; ... 45 more ...; readonly onAutoFocusOnUnmount?: ((event: CustomEvent<...>) => any) | undefined; } & VNodeProps & AllowedComponentProps & ComponentCu... }) **Description:** (No description provided) ``` -------------------------------- ### Vue HTree Component Basic Example Source: https://design.holistics.dev/components/tree This Vue.js component demonstrates the basic usage of the HTree component. It includes functionality for context menus, node expansion/collapse, and drag-and-drop. Dependencies include Vue.js and the @holistics/design-system library. The component takes an array of TreeNodeBase objects and expandedKeys as input. ```vue ``` -------------------------------- ### Vue PopoverOnboarding Component for Onboarding Source: https://design.holistics.dev/components/popover-onboarding Implements an onboarding popover using Vue.js and Holistics Design System components (HIcon, HPopoverOnboarding). It displays a notification with a title, description, and an image, typically used to guide users through new features or changes. Dependencies include '@holistics/design-system'. ```vue ``` -------------------------------- ### Shortcut Component API Source: https://design.holistics.dev/components/shortcut API documentation for the Shortcut component, detailing its available props and slots. ```APIDOC ## Shortcut Component ### Description Displays a keyboard shortcut. This component acts as a pass-through for `` elements, meaning most standard HTML attributes and events will be directly applied. ### Method N/A (Component) ### Endpoint N/A (Component) ### Parameters #### Props - **outline** (boolean) - Optional - If set to true, the shortcut will have an outline style. - **theme** ("light" | "dark") - Optional - Specifies the theme of the shortcut. Defaults to "light". #### Slots - **default** ({}) - The content of the slot is the text displayed as the shortcut (e.g., 'Esc'). ### Request Example ```vue ``` ### Response #### Success Response (200) N/A (Component) #### Response Example N/A (Component) ``` -------------------------------- ### Vue Tree Component - Generic Types Example Source: https://design.holistics.dev/components/tree Illustrates how to use generic types with the Tree component to provide type safety for node objects. This example defines a custom node type and demonstrates its usage with props and events. ```vue ``` -------------------------------- ### Dismissible Banner Example in Vue.js Source: https://design.holistics.dev/components/banner Shows how to create dismissible HBanner components in Vue.js. This example dynamically adds banners when buttons are clicked and removes them when the dismiss event is triggered. It manages the state of multiple banners using `ref`. ```vue ``` -------------------------------- ### Basic Switch Component Usage (Vue) Source: https://design.holistics.dev/components/switch Demonstrates the basic implementation of the HSwitch component from the @holistics/design-system library. It shows how to bind the switch state using v-model and includes an example of a disabled switch. Requires Vue 3 and the design system library. ```vue ``` -------------------------------- ### HPopper Component API Source: https://design.holistics.dev/components/popover-onboarding This section details the props available for the HPopper component. All props are optional and affect the positioning and behavior of the floating element. ```APIDOC ## HPopper Component API ### Description The HPopper component allows for the creation of floating UI elements with customizable behavior and positioning. Props listed below control various aspects of its functionality, including its open state, anchor, placement, and collision handling. Any props not explicitly defined here will be passed through to the underlying element. ### Props #### `open` (boolean) - Optional The opening state of the Floating element. #### `disabled` (boolean) - Optional When `true`, disable `Popper` functionalities entirely. #### `anchor` (PopperAnchorRect | PopperAnchorElement) - Optional Anchor element. Can be an object with coordinates or a virtual element. Refer to: https://floating-ui.com/docs/virtual-elements #### `safeAreaDuration` (number) - Optional Duration (ms) of the safe area to exist before closing. #### `disableOutsidePointerEvents` (boolean) - Optional When `true`, only the top layer with `disableOutsidePointerEvents = true` has `pointer-events: auto`, all lower layers will have `pointer-events: none`. This can be used as a way to force all lower layers to not emit `@pointer-down-outside` while this layer is rendered. #### `strategy` (Strategy) - Optional The type of CSS `position` property to use. This could affect the positioning computation of the Floating element. Refer to: https://floating-ui.com/docs/computeposition#strategy #### `disableTransform` (boolean) - Optional By default, the Floating element is positioned using `transform`. This is the most performant way to position elements. However, `transform` will create a new stacking context which could be problematic in some cases. For example, if there is a `position: fixed` element inside the Floating element that expects to be calculated against the viewport, `transform` positioning will place that element incorrectly, hence need to be disabled. Refer to: https://floating-ui.com/docs/vue#disabling-transform #### `placement` (Placement) - Optional The placement of the Floating element relative to the Anchor element. Refer to: https://floating-ui.com/docs/computeposition#placement #### `distance` (number) - Optional, Default: 2 The distance between the Floating element and the Anchor element (applied on the axis that runs along the *side* of the Floating element). Refer to: https://floating-ui.com/docs/offset#mainaxis #### `skidding` (number) - Optional The skidding between the Floating element and the Anchor element (applied on the axis that runs along the *alignment* of the Floating element). Refer to: https://floating-ui.com/docs/offset#crossaxis #### `allowCollisions` (boolean) - Optional Whether to allow the Floating element to collide with the boundary. #### `collisionBoundary` (Boundary) - Optional The clipping element(s) or area that collision will be checked relative to. Refer to: https://floating-ui.com/docs/detectOverflow#boundary #### `collisionPadding` (Padding) - Optional The virtual padding around the boundary to check for collision. Refer to: https://floating-ui.com/docs/detectOverflow#padding #### `noShift` (boolean) - Optional When `true`, the Floating element won't be shifted if collisions occur. Refer to: https://floating-ui.com/docs/shift #### `noFlip` (boolean) - Optional When `true`, the placement of the Floating element won't change if collisions occur. Refer to: https://floating-ui.com/docs/flip #### `prioritizePlacement` (string[]) - Optional An array of placements to try in order when `noFlip` is false. This allows for more control over fallback placements. ``` -------------------------------- ### Adding a New Icon Source: https://design.holistics.dev/base-elements/icon Step-by-step guide on how to add a new SVG icon to the design system. ```APIDOC ## Add New Icon ### Description Instructions for adding new SVG icons to the Holistics Design System. ### Steps 1. **Copy SVG:** Place the SVG file in the `./src/icons` directory. The icon name is derived from the file name (e.g., `delete.svg` becomes `delete`, `ai/blink.svg` becomes `ai/blink`). 2. **Set Fill Color:** For single-color icons, set the `fill` attribute to `currentColor` in the SVG. 3. **Generate Icon Map:** Run `node ./generateIconMap.cjs`. 4. **Bump Version:** Use `pnpm changeset` to bump the package version (recommended: `patch` for icon changes). ``` -------------------------------- ### Accordion with Pill - Vue Source: https://design.holistics.dev/components/accordion Shows how to add a 'pill' to the Accordion header for additional actions or information. This example uses the 'pill-icon' and 'pill-label' props. ```vue ``` -------------------------------- ### Accordion with Icons - Vue Source: https://design.holistics.dev/components/accordion Demonstrates how to add icons to the Accordion header for visual cues. This example uses 'icon' for the left icon and 'icon-right' for the right icon. ```vue ``` -------------------------------- ### Disabled Segmented Control Example (Vue) Source: https://design.holistics.dev/components/segmented-control Shows how to disable the HSegmentedControl component by passing the `disabled` prop. This prevents user interaction with the segmented control, making it read-only. ```vue ``` -------------------------------- ### Basic HSelect Component Usage (Vue) Source: https://design.holistics.dev/components/select Demonstrates the basic implementation of the HSelect component in Vue. It requires importing HSelect and SelectOption from '@holistics/design-system'. The component takes an array of options and a model value for the selected option, returning the chosen option's value. ```vue ``` -------------------------------- ### HDropdown Component: Options with Divider (Vue) Source: https://design.holistics.dev/components/dropdown This example shows how to include a visual divider within the HDropdown options. A 'divider' type option is added to the list, separating subsequent items. ```vue ``` -------------------------------- ### Configure HSelect with Various Option Types (Vue) Source: https://design.holistics.dev/components/select Demonstrates configuring the HSelect component with a variety of option types. This includes options with sticky positioning, tooltips, icons, descriptions, disabled states, and nested children. The example uses Vue's Composition API and TypeScript. ```vue ``` -------------------------------- ### Vue Tooltip: With Shortcuts Source: https://design.holistics.dev/components/tooltip Illustrates how to configure the HTooltip component in Vue.js to display shortcut keys. This example shows a tooltip with the content 'Lorem Ipsum' and shortcuts 'Alt' and 'E', triggered by hovering over an info icon. It depends on HIcon and HTooltip from '@holistics/design-system'. ```vue ```