### Install Chi Vue Plugin with Default Configuration Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation This TypeScript example shows the minimal setup for installing the Chi Vue plugin using `app.use(ChiVue, {})`. This automatically includes default configurations for the portal theme and the latest Chi version. ```typescript import { createApp } from 'vue'; import { ChiVue } from "@centurylink/chi-vue"; const app = createApp(App); app.use(ChiVue, {}); ``` -------------------------------- ### Install Chi Vue Plugin with Custom Theme and Version Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation This TypeScript example demonstrates how to install the Chi Vue plugin with specific configurations for theme and version. The `chiOptions` object allows you to set `theme` to 'lumen', 'portal', or 'centuryLink', and `forceVersion` to a specific Chi version string. ```typescript import { createApp } from 'vue'; import { ChiVue } from "@centurylink/chi-vue"; const app = createApp(App); app.use(ChiVue, { chiOptions: { theme: 'centurylink', forceVersion: '5.78.0' } }); ``` -------------------------------- ### Text Input: Placeholder Example (Web Component & HTML) Source: https://assets.ctl.io/chi/6.86.0/components/forms/text-input Demonstrates how to use the `placeholder` attribute to provide guidance to users on the expected input format. The placeholder text disappears once the user starts typing. ```webcomponent
Label
``` ```html
``` -------------------------------- ### Base Search Input Examples Source: https://assets.ctl.io/chi/6.86.0/components/forms/search-input_theme=portal Demonstrates the basic implementation of the search input component. It shows how to integrate the search input using Web Components, Vue, and a standard HTML Blueprint. These examples cover the fundamental structure for adding a search input to a form. ```html
``` ```html
``` ```html
``` -------------------------------- ### HTML5 Progress Element Examples Source: https://assets.ctl.io/chi/6.86.0/components/progress Illustrates the use of the native HTML5 'progress' tag for creating progress indicators. Examples are provided for 0%, 50%, and 100% progress, using 'value' and 'max' attributes, along with 'aria-labelledby' for accessibility. ```html
0%
50%
100%
``` -------------------------------- ### HTML Progress Component Examples Source: https://assets.ctl.io/chi/6.86.0/components/progress Demonstrates how to implement progress indicators using the custom Chi Web Component. It shows examples for 0%, 50%, and 100% completion, utilizing the 'chi-progress' tag with 'value' and 'max' attributes. ```html
0%
50%
100%
``` -------------------------------- ### Chi Badge HTML Blueprint Examples Source: https://assets.ctl.io/chi/6.86.0/components/badge Illustrates how to implement Chi badges using HTML and CSS classes. Includes examples for various contextual colors and emphasis levels suitable for light and dark backgrounds. ```html
Base
Primary
Success
Warning
Danger
Dark
Muted
Accent-1
Accent-2
Accent-3
Accent-4
Accent-5
Secondary
Light
``` -------------------------------- ### Dropdown Web Component Example Source: https://assets.ctl.io/chi/6.86.0/components/dropdown This example demonstrates how to use the Dropdown component as a Web Component. It requires the Chi.js library for functionality. The 'position' and 'button' attributes configure the dropdown's behavior and appearance. ```html Item 1 Item 2 Item 3 Item 4 ``` -------------------------------- ### Example Picker HTML Structure Source: https://assets.ctl.io/chi/6.86.0/components/forms/picker Illustrates a basic HTML structure for a Chi Picker component, showing content alignment and price display. This is a structural example and does not include interactive JavaScript. ```html
Option 2
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex.
$0.00/mo
``` -------------------------------- ### Initialize Chi Drawer with Chi.js Source: https://assets.ctl.io/chi/6.86.0/components/drawer This example demonstrates initializing a Chi Drawer using the Chi.js vanilla JavaScript solution. It requires specific HTML structure for the trigger and the drawer itself, and then uses the `chi.drawer()` function with the trigger element to enable its functionality. ```html
Drawer content here
``` ```javascript chi.drawer(document.getElementById('example__interaction-trigger')); ``` -------------------------------- ### Locally Register Chi Button Component (HTML/JavaScript) Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Import individual components on-demand for optimized bundle size. This example shows how to locally register and use a Chi Button component. ```html Primary ``` -------------------------------- ### Chi Expansion Panel: Base Example with Navigation Source: https://assets.ctl.io/chi/6.86.0/components/expansion-panel_theme=portal Demonstrates a standard Chi expansion panel with header, read-only summary, and an expandable body containing content and navigation buttons. This panel is part of a multi-step process. ```html
2.
Panel title
Use this area to present a read-only summary of what the user entered or selected in step 2. (e.g.) shipping address
Optional subtitle

Content in expansion panel (e.g. a form to enter shipping address)

``` -------------------------------- ### Configure AMD Module Loader for Chi Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation If using RequireJS or another AMD module loader, configure your require setup to load the Chi JavaScript library. This requires specifying the path and shim dependencies for Popper.js and Chi itself. ```javascript 'chi': { path: [CHI_PATH, 'amd', 'chi'].join('/'), shim: { deps: ['Popper'], exports: 'chi' } } ``` -------------------------------- ### Register Chi Vue Components Globally Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation This main.ts example demonstrates how to import and globally register Chi Vue components within a Vue application. It uses the `app.use()` method for the ChiVue plugin and `app.component()` for individual components like ChiSearchInput. ```typescript import { createApp } from 'vue'; import { ChiVue, ChiSearchInput } from "@centurylink/chi-vue"; import App from './App.vue'; const app = createApp(App); app.use(ChiVue, {}); app.component("ChiSearchInput", ChiSearchInput); app.mount('#app'); ``` -------------------------------- ### Chi Expansion Panel - Initial State Example Source: https://assets.ctl.io/chi/6.86.0/components/expansion-panel_theme=portal Shows the initial or default state of a Chi expansion panel. It displays a summary and an 'Edit' button. The expanded view contains a form and action buttons for user interaction. ```html
1.
Package selection
(e.g.) a package selection
Optional subtitle

Content in expansion panel (e.g. a form to select a product package)

``` -------------------------------- ### Install Chi Web Components via NPM Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Add the Chi Custom Elements package to your project's package.json file. This specifies the version of the components to be installed. ```json "@centurylink/chi-custom-elements": "1.52.0" ``` -------------------------------- ### Chi Expansion Panel States using HTML Blueprint and Chi.js Source: https://assets.ctl.io/chi/6.86.0/components/expansion-panel_theme=portal Illustrates how to implement Chi Expansion Panels using a basic HTML structure and initialize them with Chi.js. This approach requires JavaScript to enable the interactive features of the panels. ```javascript ``` ```html
1.
Done state
Use this area to present a read-only summary of what the user entered or selected in step 1. ``` -------------------------------- ### Drawer with Backdrop - Web Component Source: https://assets.ctl.io/chi/6.86.0/components/drawer Demonstrates how to implement a Chi Drawer with a backdrop using Web Components. This example includes a trigger button and the drawer element, along with JavaScript to toggle the drawer's visibility. It requires the Chi library. ```html
Drawer content here
``` -------------------------------- ### Configure NPM Registry for Chi Web Components Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Configure your .npmrc file to point to the correct registry for CenturyLink packages and include your GitHub token for authentication. This is necessary for installing Chi Web Components via NPM. ```npmrc registry=https://registry.npmjs.org @centurylink:registry=https://npm.pkg.github.com/centurylink //npm.pkg.github.com/:_authToken=${GH_TOKEN} ``` -------------------------------- ### Textarea Placeholder Example (Web Component & HTML) Source: https://assets.ctl.io/chi/6.86.0/components/forms/textarea_theme=portal Demonstrates the use of the `placeholder` attribute to provide a hint to the user about the expected input. The placeholder text disappears when the user starts typing. This example includes implementations for both Web Component and HTML blueprints. ```html
Label
``` ```html
``` -------------------------------- ### Control Chi Drawer Visibility with HTML Blueprint and Chi.js Source: https://assets.ctl.io/chi/6.86.0/components/drawer Provides an HTML Blueprint example for a Chi Drawer, demonstrating its integration with the Chi.js library for JavaScript control. This method is suitable for projects not using a specific framework. ```html
Drawer content here
``` -------------------------------- ### Modify HTML Attribute of Chi Button Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Demonstrates how to modify the 'size' attribute of a Chi Button element using `setAttribute`. This method directly manipulates the HTML attribute. ```html Close ``` -------------------------------- ### Drawer with Backdrop - HTML Blueprint Source: https://assets.ctl.io/chi/6.86.0/components/drawer Provides an HTML Blueprint for a Chi Drawer with a backdrop, designed to be used with Chi.js. This example includes the necessary HTML structure for the trigger and the drawer, along with a script tag to initialize the drawer functionality using Chi.js. ```html
Drawer content here
``` -------------------------------- ### Set DOM Property of Chi Button Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Shows how to modify the 'size' DOM property of a Chi Button element. This method directly accesses and modifies the element's property. ```html Close ``` -------------------------------- ### Textarea Base Example (Web Component & HTML) Source: https://assets.ctl.io/chi/6.86.0/components/forms/textarea_theme=portal Demonstrates the basic implementation of a textarea input. It shows how to create a textarea with a label using both the Web Component and standard HTML blueprint. The Web Component uses ``, while the HTML blueprint uses the native `
``` -------------------------------- ### Add Chi Vue and Pinia Dependencies Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation This package.json snippet adds the necessary Chi Vue library and Pinia for state management to your project's dependencies. Ensure you are using compatible versions. ```json "@centurylink/chi-vue": "3.30.0", "pinia": "^2.1.4", ``` -------------------------------- ### Globally Register Chi Web Components (TypeScript) Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Import all Chi Web Components at once in your application's entry point (e.g., main.ts) for global availability. This simplifies usage across your application. ```typescript // main.ts import '@centurylink/chi-custom-elements/ux-chi-ce'; ``` -------------------------------- ### Chi Picker with Description and Price Example (HTML) Source: https://assets.ctl.io/chi/6.86.0/components/forms/picker Demonstrates the Chi Picker component featuring both a description and pricing information for each selectable option. This is useful for services or products with associated costs. ```html
Select an option
``` -------------------------------- ### Add Lumen Favicon Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Optionally, add a Lumen favicon to your project by inserting the provided link tags before the closing `` tag. This includes both SVG and ICO formats for broad browser compatibility. ```html ``` -------------------------------- ### Chi Link Download Attribute Examples Source: https://assets.ctl.io/chi/6.86.0/components/link Shows how to implement the 'download' attribute to prompt users to save a linked resource instead of navigating to it. The attribute can optionally specify a custom filename. ```html Link Link ``` ```html Link Link ``` -------------------------------- ### Apply Chi CSS Class Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Apply the 'chi' CSS class to the `` tag of your document. This is crucial for scoping Chi styles and overriding any existing legacy styles, ensuring consistent component appearance. ```html ... ``` -------------------------------- ### Display Chi Drawer with Header using HTML Blueprint and Chi.js Source: https://assets.ctl.io/chi/6.86.0/components/drawer Shows how to create a Chi Drawer with a header using an HTML Blueprint and the Chi.js library. This approach is useful for integrating Chi components into existing HTML structures with minimal JavaScript. ```html
Drawer title here
Drawer content here
``` -------------------------------- ### Include Chi CSS Stylesheet Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation Add the Chi CSS stylesheet to your project's header by linking to the file hosted on Lumen's Assets Server. This ensures proper styling for Chi components. ```html ``` -------------------------------- ### Set Asset Path for Chi Icons (TypeScript) Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation In your main TypeScript file, import the setAssetPath helper from the Chi Custom Elements library and configure the path for Chi Icons. This ensures icons are loaded correctly. ```typescript // Chi Icons import { setAssetPath } from '@centurylink/chi-custom-elements/helpers'; setAssetPath(`https://lib.lumen.com/chi/6.86.0/js/ce/ux-chi-ce/ux-chi-ce.esm.js); ``` -------------------------------- ### Drag and Drop Base Example (Web Component) Source: https://assets.ctl.io/chi/6.86.0/components/drag-and-drop Demonstrates the basic implementation of the drag and drop component. It initializes a list of draggable items and handles the 'chiCloseClick' event to remove items. ```html ``` -------------------------------- ### Configure Chi Vue Plugin with Theme and Version Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation_theme=portal This code snippet illustrates how to configure the Chi Vue plugin with specific options, such as setting a custom theme ('centurylink') and forcing a particular Chi version ('5.78.0'). ```typescript import { createApp } from 'vue'; import { ChiVue } from "@centurylink/chi-vue"; const app = createApp(App); app.use(ChiVue, { chiOptions: { theme: 'centurylink', forceVersion: '5.78.0' } }); ``` -------------------------------- ### Chi Picker JavaScript Initialization Examples Source: https://assets.ctl.io/chi/6.86.0/components/forms/picker This snippet demonstrates how to initialize and populate the Chi Picker component using JavaScript. It covers setting options, including labels, checked states, descriptions, and IDs for different picker instances. ```javascript document.getElementById('md-picker').options = [{ label: 'Option 1', checked: true }, { label: 'Option 2' }]; document.getElementById('md-input-picker').options = [{ label: 'Option 1', checked: true }, { label: 'Option 2' }]; document.getElementById('md-input-description-picker').options = [ { label: 'Option 1', checked: true, description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex. Nulla iaculis velit sed velit vehicula dictum. Donec ut ultrices tortor. Vivamus sit amet lorem augue.', }, { label: 'Option 2', description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex. Nulla iaculis velit sed velit vehicula dictum. Donec ut ultrices tortor. Vivamus sit amet lorem augue.', } ]; document.getElementById('md-input-description-price-picker').options = [ { label: 'Option 1', checked: true, id: 'option-1', description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex. Nulla iaculis velit sed velit vehicula dictum. Donec ut ultrices tortor. Vivamus sit amet lorem augue.', }, { label: 'Option 2', id: 'option-2', description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex. Nulla iaculis velit sed velit vehicula dictum. Donec ut ultrices tortor. Vivamus sit amet lorem augue.', } ]; document.getElementById('lg-picker').options = [{ label: 'Option 1', checked: true }, { label: 'Option 2' }]; document.getElementById('lg-input-picker').options = [{ label: 'Option 1', checked: true }, { label: 'Option 2' }]; document.getElementById('lg-input-description-picker').options = [ { label: 'Option 1', checked: true, description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex. Nulla iaculis velit sed velit vehicula dictum. Donec ut ultrices tortor. Vivamus sit amet lorem augue.', }, { label: 'Option 2', description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula placerat iaculis. Ut rutrum pulvinar velit vitae molestie. Phasellus accumsan pharetra ex. Nulla iaculis velit sed velit vehicula dictum. Donec ut ultrices tortor. Vivamus sit amet lorem augue.', } ]; ``` -------------------------------- ### Configure AMD Module Loader for Chi Source: https://assets.ctl.io/chi/6.86.0/getting-started/installation_theme=portal If using RequireJS or another AMD module loader, configure your require settings to load the AMD compatible version of Chi. This requires specifying the path and shim dependencies. ```javascript 'chi': { path: [CHI_PATH, 'amd', 'chi'].join('/'), shim: { deps: ['Popper'], exports: 'chi' } } ``` -------------------------------- ### Clickable Alerts (HTML Blueprint) Source: https://assets.ctl.io/chi/6.86.0/components/alert_theme=portal This example illustrates clickable alerts using the HTML Blueprint approach, integrating with standard HTML `` tags and `button` elements for similar functionality. ```html ```