### List Header Example Source: https://digitalguidelines.michigan.gov/docs/components/list/som-list This example demonstrates a list with a header, suitable for sidebar navigation. ```html List item 1 List item 2 List item 3 List header List item 4 List item 5 List item 6 ``` -------------------------------- ### Toast Group Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-toast-group This example demonstrates how to initialize a toast group and trigger a toast using a button. ```APIDOC ## Example Usage This example shows how to add a toast group to your page and display a toast when a button is clicked. ### Component ```html
addToast()}>Show Toast
``` ### Props | Attr | Type | Default | Docs | |----------|------------------------------------|---------|----------------------------------------------------------------------| | position | "center" | "end" | "start" | 'end' | This property sets the position on the screen toast will display. | ### Methods | Name | Returns | Docs | |----------|----------------|------------------------------------| | addToast | `Promise` | This public method is used to show a toast. | ### Events | Event | Detail | Docs | |---------------------|--------|------------------------------------------------| | toastGroupDismissed | void | This event is emitted when a toast is dismissed. | ``` -------------------------------- ### Toast Examples Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-toast Examples demonstrating different configurations of the som-toast component, including auto-dismiss, manual dismissal, and custom timeout intervals. ```APIDOC ## som-toast ### Description A toast is a brief floating notification that appears on screen to confirm an action or display a status update. ### Props #### auto-dismiss (boolean) - Default: `true` - This boolean property determines whether the toast will dismiss automatically or not. #### auto-dismiss-time (number) - Default: `10000` - The timeout in milliseconds before the toast is automatically dismissed. #### close-button-aria-label (string) - Default: `"dismiss"` - This property overrides the close button aria label. #### color ("danger" | "info" | "success" | "warning") - Default: `'info'` - This property sets the toast container color. #### dismissible (boolean) - Default: `true` - This boolean determines if a toast can be dismissed. #### headline (string) - This property sets the headline for the toast. #### icon (boolean) - Default: `true` - This boolean property sets the visual status icon visibility. ### Methods #### dismiss() - Returns: `Promise` will resolve after toast is dismissed. - This public method is used to dismiss a toast. ### Events #### toastDismissed - Detail: `void` - This event is emitted when the toast is dismissed. ### Parts #### body - This part is the body text content. #### close-button - This part is the close button. #### headline - This part is the headline content. #### icon - This part is the optional icon next to the headline. ### Example Usage ```html
By default, this toast notification will auto-dismiss after 10 seconds. This toast notification is configured to dismiss manually. A user can't dismiss this toast, but it will dismiss automatically after a custom timeout interval of 30 seconds. This is a demo of a dismissible toast notification.
``` ``` -------------------------------- ### Install Digital Guidelines React Package Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/react Install the core React package for Digital Guidelines components. ```bash npm install @migov/digital-guidelines-core-react ``` -------------------------------- ### Install Digital Guidelines via NPM Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/cdn Install the Digital Guidelines package using npm. This command saves the package to your project's dependencies. ```bash npm install @migov/digital-guidelines-core --save ``` -------------------------------- ### Open Popover Example Source: https://digitalguidelines.michigan.gov/docs/components/overlays/som-popover This example demonstrates how to open a popover by associating it with a button using the 'for' property and toggling its visibility with a click event. ```html Open popover Popover content goes here ``` -------------------------------- ### Grid with No Gutters Example Source: https://digitalguidelines.michigan.gov/docs/utilities/grid Demonstrates the application of `.no-gutters` within a container to remove spacing between columns. This example shows how columns adjust when gutters are removed. ```html
.col-12 .col-sm-6 .col-md-8
.col-6 .col-md-4
``` -------------------------------- ### Open Modal Example Source: https://digitalguidelines.michigan.gov/docs/components/overlays/som-modal Demonstrates how to open a modal using a button click. The modal can be customized with a headline, size, and content. ```html Open modal

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

``` -------------------------------- ### Button Examples Source: https://digitalguidelines.michigan.gov/docs/components/button/som-button Demonstrates various configurations of the som-button component, including size, type, color, and icon usage. Use these examples to understand different button styles and functionalities. ```html call to action ``` ```html call to action ``` ```html call to action ``` ```html call to action ``` ```html call to action ``` ```html call to action ``` ```html call to action ``` ```html
``` -------------------------------- ### Install Digital Guidelines Angular Package Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/angular/standalone Install the core Digital Guidelines Angular package using NPM to add components to your project. ```bash npm install @migov/digital-guidelines-core-angular ``` -------------------------------- ### Include Digital Guidelines via NPM in HTML Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/cdn After installing via NPM, add these script tags to the `` section of your HTML file to reference the local installation of Digital Guidelines. ```html ``` -------------------------------- ### Basic Data Grid Example Source: https://digitalguidelines.michigan.gov/docs/components/datagrid/som-grid This example demonstrates a basic Data Grid with sortable and hoverable features. It includes a table with headers and data rows. ```html
ID Animal name Animal type
1 Kitty cat
2 Doug dog
3 Travis tiger
``` -------------------------------- ### Alert Examples Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Examples demonstrating different types of alerts: informational, success, warning, and error. Alerts can be configured with a headline and dismissibility. ```APIDOC ## Example ### Informational alert This is an important message that your user should know about. ### Success alert Let the user know that they successfully accomplished a task. ### Warning alert Warn the user about something. ### Error Alert Inform the user about an error that has occurred. ```html This is an important message that your user should know about. Let the user know that they successfully accomplished a task. Warn the user about something. Inform the user about an error that has occurred. ``` ``` -------------------------------- ### Header Component Example Source: https://digitalguidelines.michigan.gov/docs/components/navigation/som-header This is a basic example of the Header component. It requires the `main-content-id` prop to be set for the skip navigation link. The `header-menu` slot is used to populate the main navigation. ```html Link 1
``` -------------------------------- ### Input Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/forms/som-input Examples of how to use the som-input component with different configurations. ```APIDOC ## Example Usage ### Basic Input ```html ``` ### Input with Error ```html ``` ### Password Input ```html ``` ### Input with Tooltip ```html ``` ``` -------------------------------- ### Panel Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/overlays/som-panel Example of how to open and use the Panel component with its content. ```APIDOC ## Panel Component Panels are partial-screen overlays that focus users’ attention while keeping them in context within a flow. They’re used for tasks like editing, filtering, or viewing details. ### Example ```html Open panel
Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

End of panel
``` ## Props | Attr| Type| Default| Docs ---|---|---|--- | below-header| boolean| false| This boolean property is used to determine if the panel should show over or below header. | breakpoint| "lg" | "md" | "sm" | "xl"| 'lg'| This property is where the mobile navigation should take effect. | enable-overlay-close| boolean| true| This boolean allows the panel to be closed when clicking on the overlay outside the panel. | hide-close-button| boolean| false| This boolean property is used to hide the panel's close button. | position| "left" | "right"| 'left'| This property is where the panel should appear. | scroll-to-top| boolean| true| This boolean determines whether the page scrolls back to the top upon panel opening. | shown| boolean| false| This boolean property is used to display or hide the panel on initial load. | size| "lg" | "md" | "sm" | "xl"| 'md'| This property is used to control the panel’s width. The sizes are as follows: `sm = 20rem`, `md = 30rem`, `lg = 40rem`, `xl = fullscreen - 38px`. ## Methods | Name| Returns| Docs ---|---|--- | close| Promise will resolve when the close animation ends.| This method will close the panel. | open| Promise will resolve when the open animation ends.| This method will open the panel. | refresh| Promise will resolve after the refresh.| This method will refresh the panel. This can be used when loading asynchronous data, which allows the component to find focusable elements and provide optimal accessibility support. ## Events | Event| Detail| Docs ---|---|--- | afterClose| any| This event is triggered right after panel is closed. | afterOpen| any| This event is triggered right after panel is opened. | beforeClose| any| This event is triggered just before panel is closed. | beforeOpen| any| This event is triggered just before panel is opened. ``` -------------------------------- ### Align Content Start Utility Source: https://digitalguidelines.michigan.gov/docs/utilities/flex Use `align-content-start` on a flex container to align items to the start of the cross axis. Requires `flex-wrap: wrap` to be effective. ```html
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
``` -------------------------------- ### Basic Grid Layout Example Source: https://digitalguidelines.michigan.gov/docs/utilities/grid This example demonstrates a basic grid layout with three equal-width columns that span across small, medium, large, and extra-large devices. The `.container` class centers the columns on the page. ```html
.col-sm
.col-sm
.col-sm
``` -------------------------------- ### Basic List Parent Item Example Source: https://digitalguidelines.michigan.gov/docs/components/list/som-list-parent-item This example demonstrates how to use the `som-list-parent-item` component within a `som-list` with the type 'header'. It includes child `som-list-item` elements. ```html List item 1 List item 2 List item 3 ``` -------------------------------- ### Basic Date Picker Input Example Source: https://digitalguidelines.michigan.gov/docs/components/date-picker/som-date-picker-input This example demonstrates a basic date picker input with a label and help text. It uses the current date as the initial value and specifies the MM/DD/YYYY format. ```html ``` -------------------------------- ### Header Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/navigation/som-header This example demonstrates how to use the som-header component with its available props and slots. ```APIDOC ## som-header Component ### Description This component is a menu that goes across the top of a website. It helps users know what page of a website they're on, and lets them access the main sections of a site through top-level navigation. ### Props - **app-name** (string) - Optional - The name of the application. - **breakpoint** (string: "lg" | "md" | "none" | "sm" | "xl") - Optional - The breakpoint where the mobile navigation should take effect. Setting the value to `"none"` will always show the flyout menu. - **department-name** (string) - Optional - The name of the department where the application resides. - **home-link** (string) - Optional - Used to set a link on the header logo and title text. - **main-content-id** (string) - Required - The ID of the main content section of the application. It is used to establish a connection for the "skip navigation" link. - **sticky** (boolean) - Optional - Determines if the header should stick to the top of scroll with the content. ### Methods - **closePanelMenu** - Returns: Promise will resolve when the close animation ends. - This method will close the panel menu if opened. It can be useful when a menu link is clicked but the page doesn't refresh. ### Slots - **header-menu** - This slot is used for the main horizontal header menu. - **panel-menu** - This slot is used for the fly out panel menu. ### Example ```html Link 1
``` ``` -------------------------------- ### Tabs Component Example Source: https://digitalguidelines.michigan.gov/docs/components/tabs/som-tabs This example demonstrates the basic structure of the Tabs component, including tab groups and tab panels. Ensure all tab panels are present, even if not immediately visible, to maintain correct functionality. ```html This is panel 1 This is panel 2 This is panel 3 This is panel 4 This is panel 5 ``` -------------------------------- ### Warning Toast Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-toast-group Illustrates a warning toast to caution about potential problems. The toast is configured with the 'warning' color. An additional example demonstrates disabling auto-dismiss and dismissible options. ```html
Please use a supported file type, such as .pdf, .docx, or .png.
Free up some space to avoid issues. ``` -------------------------------- ### Dialog Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/overlays/som-dialog Example of how to open a dialog using a button and the basic structure of a som-dialog component. ```APIDOC ## Example Open dialog Dialog headline Dialog content goes here. Cancel Confirm View code ```html Open dialog

Dialog content goes here.

``` ``` -------------------------------- ### Badge Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/som-badge Examples of how to use the Badge component with different properties. ```APIDOC ## Example Reminders New emails View code ```html

Reminders

New emails

``` ``` -------------------------------- ### Basic Tab Panel Group Example Source: https://digitalguidelines.michigan.gov/docs/components/tabs/som-tab-panel-group This example demonstrates the basic structure of a Tab Panel Group, containing three tab panels. Each panel holds content that will be displayed when its associated tab is selected. It is used in conjunction with a som-tab-group. ```html This is panel 1 This is panel 2 This is panel 3 ``` -------------------------------- ### Sidebar Basic Usage Source: https://digitalguidelines.michigan.gov/docs/components/navigation/som-sidebar This is a basic example of how to implement the som-sidebar component with a list of navigation links. ```html Link 1 Link 2 Link 3 List heading 1 Link 4 Link 5 Link 6 ``` -------------------------------- ### Data Grid Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/data-grid/som-grid Example of how to implement the Data Grid component with a table, including sortable headers. ```APIDOC ## Component Data Grid Grids are used when displaying a data table. ## Example ID| Animal name| Animal type ---|---|--- 1| Kitty| cat 2| Doug| dog 3| Travis| tiger
ID Animal name Animal type
1 Kitty cat
2 Doug dog
3 Travis tiger
``` -------------------------------- ### Use a Som Button Component Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/cdn Incorporate a basic button component into your HTML after installing the necessary packages. This example shows a default button with a primary color. ```html call to action ``` -------------------------------- ### Basic Input Examples Source: https://digitalguidelines.michigan.gov/docs/components/forms/som-input Demonstrates various configurations of the input component, including required fields, error messages, password types, and tooltips. ```html ``` -------------------------------- ### Select Component Usage Source: https://digitalguidelines.michigan.gov/docs/components/forms/som-select Examples demonstrating how to use the som-select component with various configurations, including required fields, error states, and tooltips. ```APIDOC ## som-select ### Description Allows users to make a single choice from a list of options in a dropdown menu. ### Props Attr| Type| Default| Docs ---|---|---|--- `disabled`| boolean| false| This boolean can be used to disable the select. `error`| string| null| This property can be used to set an error. If a non-empty string is given, it will be used as the error message. `help`| string| ''| This property can be used to set a help text. `hide-label`| boolean| false| This property will visually hide the label. A label is still required to be provided for screenreader support. `input-aria-label`| string| null| This property can be used to set the ARIA label associated with this input (for screen readers). `input-id`| string| generateId('som-input')| This property can be used to specifically set an ID to the input field. If an ID is not provided, it will be dynamically generated. `label`| string| ''| This property can be used to set a label. `label-class`| string| ''| This property is a list of CSS classes that can be used to style the label. `name`| string| ''| This property can be used to set the form field name (used when submitting the form). `readonly`| boolean| false| This boolean can be used to set the select input as readonly. `required`| boolean| false| This boolean can be used to set the select as required. `required-ind`| "none" | "optional" | "required"| | This property is used to override the required indicator. By default, forms elements will show an `optional` indicator but some forms are better served showing the `required` indicator instead. `tooltip`| string| null| This property is used to set the tooltip text. `value`| string| | This property can be used to set the select value. ### Methods Name| Returns| Docs ---|---|--- `setFocus`| Promise will resolve after focus.| This public method sets focus to the select element. ### Events Event| Detail| Docs ---|---|--- `somBlur`| any| This event is emitted when when the select field loses focus. `somChange`| any| This event is emitted when the select value changes. `somFocus`| any| This event is emitted when when the select field gets focus. ### Slots Name| Docs ---|--- `label`| Label for the select. Alternatively, you can use the label attribute. ### Example ```html ``` ``` -------------------------------- ### Info Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Example of an info alert, used to share neutral, non-urgent details with the user. ```APIDOC ### Info Use the info type to share neutral, non-urgent details with the user. ```html You have early access to this new beta feature! Expect updates and improvements as we gather feedback. ``` ``` -------------------------------- ### Initialize New Angular Project Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/angular/standalone Use the Angular CLI to create a new project. It's recommended to select SCSS for stylesheet format to leverage additional styling helpers. ```bash ng new project-name ``` -------------------------------- ### Warning Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Example of a warning alert, used to caution about potential issues or unexpected results. ```APIDOC ### Warning Use the warning type to caution about potential issues or unexpected results. ```html Your password expires in 3 days. ``` ``` -------------------------------- ### Success Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Example of a success alert, used to confirm a successful action or completed task. ```APIDOC ### Success (default) Use the success type to confirm a successful action or completed task. ```html You created a new account. ``` ``` -------------------------------- ### Basic Pagination Examples Source: https://digitalguidelines.michigan.gov/docs/components/som-pagination Demonstrates two ways to use the som-pagination component. The first shows records within a page range and the second shows items per page. ```html ``` ```html ``` -------------------------------- ### Error Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Example of an error alert, used to signal a problem that needs the user's attention. ```APIDOC ### Error Use the error type to alert that something has gone wrong. ```html We couldn’t complete your request. Please try again. ``` ``` -------------------------------- ### Popover Usage Example Source: https://digitalguidelines.michigan.gov/docs/components/overlays/som-popover This example demonstrates how to use the som-popover component, including its association with a trigger element and content. ```APIDOC ## Example Open popover Popover content goes here View code ```html Open popover Popover content goes here ``` ``` -------------------------------- ### Error Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Use the error alert type to signal that something has gone wrong. This example includes a headline and an error message. ```html We couldn’t complete your request. Please try again. ``` -------------------------------- ### Basic Flex Order Example Source: https://digitalguidelines.michigan.gov/docs/utilities/flex Demonstrates how to use the 'order' utility classes to change the visual order of flex items. Items with lower order values appear first. ```html
First flex item
Second flex item
Third flex item
``` -------------------------------- ### Responsive Table Example Source: https://digitalguidelines.michigan.gov/docs/utilities/table Wrap tables in a `table-responsive` div to enable horizontal scrolling on mobile devices. This example demonstrates a basic table structure. ```html
ID Animal name Animal type
1 Kitty cat
2 Doug dog
3 Travis tiger
``` -------------------------------- ### Toast Examples Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-toast Demonstrates various configurations of the som-toast component, including default auto-dismissal, manual dismissal, and custom timeout with no dismissible option. ```html
By default, this toast notification will auto-dismiss after 10 seconds. This toast notification is configured to dismiss manually. A user can't dismiss this toast, but it will dismiss automatically after a custom timeout interval of 30 seconds. This is a demo of a dismissible toast notification.
``` -------------------------------- ### Initialize Vite React Project Source: https://digitalguidelines.michigan.gov/docs/gettingstarted/react Use this command to create a new Vite project with React. Choose the react-ts template if you prefer TypeScript. ```bash npm create vite@latest my-react-app -- --template react ``` ```bash npm create vite@latest my-react-app -- --template react-ts ``` -------------------------------- ### Info Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Use the info alert type to share neutral, non-urgent details with the user. This example includes a headline and an informational message. ```html You have early access to this new beta feature! Expect updates and improvements as we gather feedback. ``` -------------------------------- ### Basic Mobile Subheader Example Source: https://digitalguidelines.michigan.gov/docs/components/navigation/som-mobile-subheader This example demonstrates the basic usage of the som-mobile-subheader component. Resize your browser to observe its behavior on different screen sizes. ```html

Resize browser to see som-mobile-subheader component.

Link 1 Link 2 Link 3 List heading 1 Link 4 Link 5 Link 6 ``` -------------------------------- ### Basic Card Examples Source: https://digitalguidelines.michigan.gov/docs/components/card/som-card Demonstrates various card configurations, including cards with images, text content, and different color variants. The `som-card` component accepts a `color` prop to change its background and border. ```html
placeholder image

Card with image

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi suscipit quam eget odio sollicitudin ullamcorper aliquam ac magna varius.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Learn more Lorem ipsum dolor sit amet consectetur adipiscing. Lorem ipsum dolor sit amet consectetur adipiscing.
``` -------------------------------- ### Warning Alert Example Source: https://digitalguidelines.michigan.gov/docs/components/notifications/som-alert Use the warning alert type to caution users about potential issues or unexpected results. This example includes a headline and a warning message. ```html Your password expires in 3 days. ```