### React example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/docs/stories/Installation.mdx An example of how to use Spirit components in React, demonstrating a more declarative approach. ```jsx // React import { Container, Stack, TextField, CheckboxField, Button } from '@alma-oss/spirit-web-react'; ... ``` -------------------------------- ### HTML example (for comparison) Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/docs/stories/Installation.mdx An example of how UI elements might be structured using plain HTML and Spirit CSS classes. ```html
``` -------------------------------- ### Import and use components Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/docs/stories/Installation.mdx Example of importing and using a Button component from spirit-web-react. ```jsx import React from 'react'; import { Button } from '@alma-oss/spirit-web-react'; export default (props) => { return ; }; ``` -------------------------------- ### Input on Start Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Toggle/README.md Example of a Toggle component with the input positioned at the start. ```html
``` -------------------------------- ### Run the development server Source: https://github.com/alma-oss/spirit-design-system/blob/main/examples/next-with-pages-router/README.md Command to start the Next.js development server. ```bash yarn dev ``` -------------------------------- ### Get or Create Instance and Event Listener Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Collapse/README.md Shows how to get or create a collapse instance and attach an event listener for the 'hidden.collapse' event. ```javascript const myCollapseEl = document.getElementById('my-collapse'); const collapse = Collapse.getOrCreateInstance(myCollapseEl); myCollapseEl.addEventListener('hidden.collapse', () => { // do something... }); collapse.hide(); ``` -------------------------------- ### Dropdown JavaScript Instance Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Dropdown/README.md Shows how to get an instance of the Dropdown component using its static `getInstance` method and then call the `show` method on it. ```javascript const dropdown = Dropdown.getInstance('#example'); // Returns a dropdown instance dropdown.show(); ``` -------------------------------- ### Usage Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/scripts/lts-schedule/README.md Example of how to use the lts-schedule command line utility. ```bash node bin/lts.js -s 2021-07-01 -e 2027-06-01 -h output.html -g output.svg -p output.png ``` -------------------------------- ### Full Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Heading/README.md Demonstration of a full example of the Heading component. ```tsx Demonstration of a full example of the Heading component. ``` -------------------------------- ### UncontrolledToast Setup Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Toast/README.md Example showing how to set up and use the `UncontrolledToast` component with `ToastProvider` and the `useToast` hook. ```tsx import React from 'react'; import { Button, ToastProvider, UncontrolledToast, useToast } from '@alma-oss/spirit-web-react'; export const Example = () => { const { show } = useToast(); // must be inside ToastProvider /* … */ return ( ); }; ``` -------------------------------- ### Example with the Current Item in the First Place Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Pagination/README.md Demonstrates a pagination setup where the current page is the first item. ```tsx {'...'} ``` -------------------------------- ### Install spirit-web-react Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/docs/stories/Installation.mdx Install the spirit-web-react package along with its React dependencies using npm. ```sh npm install @alma-oss/spirit-web-react react react-dom ``` -------------------------------- ### Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Icon/README.md Example of using the Icon component. ```tsx import { Icon, IconsProvider } from '@alma-oss/spirit-web-react'; import icons from '@alma-oss/spirit-icons/icons'; Hey! Pay attention! ; ``` -------------------------------- ### Installation Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/vite-plugin-spirit-icons/README.md Install the plugin and vite as development dependencies. ```bash npm install --save-dev @alma-oss/vite-plugin-spirit-icons vite ``` -------------------------------- ### Responsive Avatar Examples Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Avatar/preview.html Examples of responsive avatars. ```html JB Jiří Bárta JB Jiří Bárta ``` -------------------------------- ### Install using npm Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/README.md Install the spirit-web and spirit-web-react packages using npm. ```shell npm install --save @alma-oss/spirit-web @alma-oss/spirit-web-react ``` -------------------------------- ### Full Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Icon/README.md A comprehensive example demonstrating various attributes of the Icon component. ```tsx import { Icon, IconsProvider } from '@alma-oss/spirit-web-react'; import icons from '@alma-oss/spirit-icons/icons'; Hey! Pay attention! ; ``` -------------------------------- ### Install using Yarn Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/README.md Install the spirit-web and spirit-web-react packages using Yarn. ```shell yarn add @alma-oss/spirit-web @alma-oss/spirit-web-react ``` -------------------------------- ### Basic example usage Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Select/README.md Basic example usage of the Select component. ```tsx ``` -------------------------------- ### Get Instance Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Collapse/README.md Demonstrates how to get an existing collapse instance associated with a DOM element. ```javascript const collapse = Collapse.getInstance('#example'); // Returns a collapse instance collapse.show(); ``` -------------------------------- ### ProductLogo Full Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/ProductLogo/README.md A comprehensive example demonstrating both image and SVG usage within the ProductLogo component. ```html ``` -------------------------------- ### Item with Icon Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Item/README.md An example of the Item component with an icon positioned at the start. ```html ``` -------------------------------- ### Toast Instance Creation and Display Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Toast/README.md Example of how to import the Toast plugin, create a new Toast instance with various configuration options, and display it using the `show` method. ```javascript import Toast from '@alma-oss/spirit-web/dist/js/Toast'; const toast = new Toast(null, { autoCloseInterval: 3000, // Set interval after ToastBar will be closed in ms, default: 3000 color: 'informative', // One of ['neutral' (default), 'success', 'warning, 'danger', 'informative'] containerId: 'toast-example', // Must match the ID of the Toast container in HTML enableAutoClose: true, // If true, ToastBar will close after `autoCloseInterval`, default: true message: 'Hello, this is my toast message!', // Can be plain text or HTML linkContent: 'Action', // Link text linkProps: { href: 'https://example.com', // Link URL target: '_blank', // Optional link target attribute underlined: false, // Optional link underlining, one of ['always' (default), 'hover', 'never'] isDisabled: false, // Optional link disabling, default: false elementType: 'a', // Optional link element type, default: 'a' }, hasIcon: true, iconName: 'info', // Optional icon name used as the #fragment in the SVG sprite URL id: 'my-toast', // An ID is required for dismissible ToastBar isDismissible: true, }); tOast.show(); ``` -------------------------------- ### Run Development Server Source: https://github.com/alma-oss/spirit-design-system/blob/main/examples/next-with-app-router/README.md Commands to start the Next.js development server. ```bash npm run dev ``` ```bash yarn dev ``` -------------------------------- ### Navigation Example with Links Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Header/README.md Shows how to implement single-level navigation using HeaderNav, HeaderNavItem, and HeaderLink. ```tsx Job offers Part-time jobs Inspiration Replies Employers ``` -------------------------------- ### Default Button Examples Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Button/index.html Examples of default buttons with different sizes and colors. ```html Button primary Button secondary Button tertiary Button plain Button success Button informative Button warning Button danger ``` -------------------------------- ### Basic Grid Item Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Grid/README.md A basic example of a Grid with two Grid Items, one for content and one for a sidebar, defined by column start and end. ```html
Content
Sidebar
``` -------------------------------- ### Icon Avatar Examples Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Avatar/preview.html Examples of icon avatars in different sizes. ```html ``` -------------------------------- ### Grid Placement Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Grid/README.md Example demonstrating how to place a Grid Item using CSS variables for column and row start/end. ```html
``` -------------------------------- ### Uncontrolled Pagination Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Pagination/README.md Example of an uncontrolled pagination component with total pages and a default starting page. ```tsx { console.log(pageNumber); }} /> ``` -------------------------------- ### Full Example with Image and SVG Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/PartnerLogo/README.md Demonstrates the usage of PartnerLogo with both image and SVG content. ```html ``` -------------------------------- ### Custom Spacing from Tablet Up Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Flex/README.md Example of setting custom horizontal spacing starting from the tablet breakpoint. ```html
Item 1
Item 2
Item 3
``` -------------------------------- ### Full Example: Header with Responsive Navigation Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Header/README.md A comprehensive example demonstrating the Header component with responsive navigation, including mobile actions and desktop navigation, along with its associated dialog. ```html
Spirit
``` -------------------------------- ### Grid Item Rows Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Grid/README.md Example showing how to set rows for a Grid Item using `--grid-item-row-start` and `--grid-item-row-end` variables, including a desktop-specific row setting. ```html
Content
Sidebar
``` -------------------------------- ### Example with the Current Item in the Last Place Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Pagination/README.md Illustrates a pagination setup where the current page is the last item displayed. ```tsx {'...'} ``` -------------------------------- ### Responsive Columns Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Grid/README.md Example showing responsive grid item placement using breakpoint-specific CSS variables for columns. ```html
Content
Sidebar
``` -------------------------------- ### Environment Variable Setup in .env File Source: https://github.com/alma-oss/spirit-design-system/blob/main/CONTRIBUTING.md Example of setting the FIGMA_ACCESS_TOKEN in a .env file. ```bash FIGMA_ACCESS_TOKEN=your-token-here ``` -------------------------------- ### JavaScript Plugin API Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/FileUploader/README.md Demonstrates how to get a FileUploader instance and interact with its methods like getFileQueue and access its inputElement. ```javascript const myUploaderInstance = FileUploader.getInstance('#myUploader'); // Returns a file uploader instance const fileList: File[] = myUploaderInstance.getFileQueue(); const input = myUploaderInstance.inputElement; // Returns an input element, for further use ``` -------------------------------- ### Opening the ToastBar Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Toast/README.md Example of how to open a ToastBar by setting the `isOpen` prop to `true`. The ToastBar must be present in the DOM. ```tsx Opened ToastBar ``` -------------------------------- ### Parent Element Setup Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/helpers/dynamic-color/README.md Example of setting the background and text color on a parent element. ```html
``` -------------------------------- ### Configuring Playwright Options Locally Source: https://github.com/alma-oss/spirit-design-system/blob/main/docs/contribution/e2e-testing.md Command to copy the example Playwright configuration file for local customization. ```bash cp .env.local.playwright.example .env.local.playwright ``` -------------------------------- ### Environment Variable Setup for Figma Access Token Source: https://github.com/alma-oss/spirit-design-system/blob/main/CONTRIBUTING.md Example of setting the FIGMA_ACCESS_TOKEN environment variable. ```bash export FIGMA_ACCESS_TOKEN=your-token-here ``` -------------------------------- ### SKILL.md Frontmatter Source: https://github.com/alma-oss/spirit-design-system/blob/main/docs/contribution/style.md Example of the minimum required YAML frontmatter for a SKILL.md file, including 'name' and 'description'. ```yaml --- name: spirit:{skill-name} description: One sentence describing when to use this skill. --- ``` -------------------------------- ### Open on load example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Collapse/README.md Illustrates how to have the Collapse component open by default. ```html
content
``` -------------------------------- ### Skill Frontmatter Name Source: https://github.com/alma-oss/spirit-design-system/blob/main/docs/contribution/style.md Example of how to define the 'name' field in the frontmatter of a skill, including the 'spirit:' namespace prefix. ```yaml name: spirit:release-notes ``` -------------------------------- ### Full Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Toast/README.md A comprehensive example demonstrating the usage of ToastBar within a Toast container, including state management for opening and closing. ```tsx import React, { useState } from 'react'; import { Button, Toast, ToastBar, ToastBarMessage, ToastBarLink } from '@alma-oss/spirit-web-react'; export const Example = () => { const [isOpen, setIsOpen] = useState(false); return ( <> setIsOpen(false)} isDismissible> Toast message Action ); }; ``` -------------------------------- ### Full PricingPlan Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/PricingPlan/README.md A comprehensive example demonstrating the usage of the PricingPlan component along with its header, body, and footer. It showcases how to configure various props like `isHighlighted`, `action`, `badge`, `title`, `subtitle`, `price`, `note`, `id`, `description`, and `features`. ```tsx import { PricingPlan, PricingPlanHeader, PricingPlanBody, PricingPlanFooter } from '@alma-oss/spirit-web-react'; Call to Action } badge="Recommended" title={Plan} subtitle="Supporting text" price="Price Amount" note="Additional information" /> Footer content ; ``` -------------------------------- ### Item with Icon and Helper Text in Selected State Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Item/README.md A complex example of an Item component with start icon, helper text, and selected state. ```html ``` -------------------------------- ### Theming Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/README.md Apply themes by including theme CSS files before foundation CSS. ```html

This paragraph uses the default light theme.

This paragraph uses the light theme on brand background.

``` -------------------------------- ### Toast Plugin API - Get Instance Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Toast/README.md Demonstrates how to use the static `getInstance` method of the Toast plugin to retrieve an existing Toast instance associated with a DOM element. ```javascript const toast = Toast.getInstance('#example'); // Returns a toast instance tOast.show(); ``` -------------------------------- ### Install Spirit Design System Packages Source: https://github.com/alma-oss/spirit-design-system/blob/main/examples/next-with-app-router/README.md Commands to install the necessary Spirit Design System packages. ```bash npm install @alma-oss/spirit-design-tokens @alma-oss/spirit-icons @alma-oss/spirit-web @alma-oss/spirit-web-react ``` ```bash yarn add @alma-oss/spirit-design-tokens @alma-oss/spirit-icons @alma-oss/spirit-web @alma-oss/spirit-web-react ``` -------------------------------- ### Full Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/EmptyState/README.md A full example demonstrating the usage of the EmptyState component with various sections and actions. ```tsx Heading Description Primary Action Secondary Action Link to something ``` -------------------------------- ### Wrapping Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Flex/preview.html Demonstrates how items wrap when the container width is insufficient. ```html {{setVar "items" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 }} {{#each @root.items}} Item {{this}} {{/each}} ``` -------------------------------- ### Install with npm Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/README.md Install the @alma-oss/spirit-web package using npm. ```shell npm install --save @alma-oss/spirit-web ``` -------------------------------- ### Quick Start with CSS Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/README.md Link the pre-built Spirit CSS files in your HTML template. ```html ``` -------------------------------- ### Install with Yarn Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/README.md Install the @alma-oss/spirit-web package using Yarn. ```shell yarn add @alma-oss/spirit-web ``` -------------------------------- ### Full Example - NavigationAction and NavigationAvatar Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Navigation/README.md A complete navigation bar example using NavigationAction and NavigationAvatar components. ```html ``` -------------------------------- ### Install with NPM Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/icons/README.md Command to install the package using NPM. ```shell npm install --save @alma-oss/spirit-icons ``` -------------------------------- ### Install Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/analytics/README.md Install the spirit-analytics package using NPM or Yarn. ```shell # NPM npm install --save-dev @alma-oss/spirit-analytics # Yarn yarn add -D @alma-oss/spirit-analytics ``` -------------------------------- ### Accessibility Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/PricingPlan/README.md Example demonstrating the use of aria-labelledby for better accessibility by linking the action button to the plan title. ```html

Plan Title

``` -------------------------------- ### Install with Yarn Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/icons/README.md Command to install the package using Yarn. ```shell yarn add @alma-oss/spirit-icons ``` -------------------------------- ### Install with npm Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/Icon/README.md To use this component in your project you need to run the following command using npm. ```bash npm install -S @alma-oss/spirit-icons ``` -------------------------------- ### Basic Example Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/VisuallyHidden/README.md Basic example usage of the VisuallyHidden component. ```tsx Label ``` -------------------------------- ### CardLogo with PartnerLogo Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web/src/scss/components/Card/README.md Example of using CardLogo with the recommended PartnerLogo subcomponent. ```html ``` -------------------------------- ### Basic example usage Source: https://github.com/alma-oss/spirit-design-system/blob/main/packages/web-react/src/components/TextArea/README.md Basic example of TextArea usage. ```tsx