### Building Kelp UI with npm and ESBuild Source: https://kelpui.com/docs/customizing/install This snippet shows the command-line instructions for setting up and building Kelp UI using npm and the included ESBuild script. It first installs the necessary dependencies and then executes the build process to compile customized CSS and JavaScript files. ```bash npm install npm run build ``` -------------------------------- ### KelpUI Tabs with a Starting Tab Option Source: https://kelpui.com/docs/components/tabs Illustrates how to configure the `` component to display a specific tab and its content as the default upon loading. This is achieved by adding the `start` attribute to the `` element with the ID of the desired content. ```html
...
...
...
``` -------------------------------- ### Aligning Navbar Items to Start Source: https://kelpui.com/docs/components/navbar Illustrates how to change the justification of navbar items, especially when they wrap. By default, items center. This example shows how to align them to the start using the `--justify` CSS variable, either globally via CSS or inline. ```css @layer kelp.extend { .navbar { --justify: start; } } ``` ```html ``` -------------------------------- ### CDN Install - Kelp UI Source: https://kelpui.com/docs/getting-started/installation Install Kelp UI using a Content Delivery Network (CDN) for quick and simple integration. This method includes both the CSS and JavaScript files, enabling immediate use of the library's features. ```html ``` -------------------------------- ### Kelp UI Accessibility Color Contrast Example (CSS) Source: https://kelpui.com/docs/customizing/colors Illustrates a subset of Kelp UI's primary color variables, specifically demonstrating the 'muted' variation. This example highlights the color shade differences used to meet WCAG AA and AAA contrast guidelines. ```css :where(:root) { --color-primary-fill-muted: var(--color-blue-95); --color-primary-border-muted: var(--color-blue-90); --color-primary-on-muted: var(--color-blue-30); } ``` -------------------------------- ### Kelp UI Pre-scaling Example (HTML) Source: https://kelpui.com/docs/getting-started/typography Illustrates the less efficient method of applying size classes individually to each element within a container. This approach is contrasted with the 'em' unit scaling provided by Kelp UI. ```html

Hello world!

How are you today?

``` -------------------------------- ### Kelp UI Dialog Methods Example (JavaScript) Source: https://kelpui.com/docs/components/dialog Provides examples of using the JavaScript methods available on a dialog element: 'showModal()' to open it, 'close()' to close it, and 'requestClose()' to close it while emitting a 'cancel' event. ```javascript const modal = document.querySelector('#my-modal'); // Open the modal/drawer modal.showModal(); // Close the modal modal.close(); // Close the modal with a cancel event modal.requestClose(); ``` -------------------------------- ### Starter HTML - Kelp UI Integration Source: https://kelpui.com/docs/getting-started/installation A basic HTML template demonstrating how to integrate Kelp UI using local CSS and JavaScript files. This serves as a starting point for building web pages with Kelp UI. ```html Kelp

👋 Hi, Universe!

``` -------------------------------- ### Basic Badge Usage (HTML) Source: https://kelpui.com/docs/components/badges Demonstrates the fundamental usage of the `.badge` class to create a simple badge element. This is the starting point for all badge implementations. ```html Coming Soon... ``` -------------------------------- ### Stack Layout Example Source: https://kelpui.com/docs/layout/stack Demonstrates the basic usage of the `.stack` class to create a vertically spaced layout. It is commonly used for long-form content or form elements where consistent spacing is desired between items. ```html
Merlin
Gandalf
Radagast
``` -------------------------------- ### Kelp UI Breakout Example (HTML) Source: https://kelpui.com/docs/layout/container Illustrates the use of the `.breakout` class in Kelp UI, which allows an element to span the full width of the page while maintaining its position within the normal document flow. ```html

Some normally contained content.

This spans the full width of the page.
``` -------------------------------- ### KelpUI Text Formatting Example (HTML) Source: https://kelpui.com/docs/components/text Demonstrates various text formatting options available in KelpUI, including bold, italic, strikethrough, highlighting, and subscript/superscript. This example utilizes HTML tags and KelpUI's implied styling. ```html This is default text. This is bold... ...and this is italic. This is what they look like together. This is strikethrough text. This text is highlighted. Superscripts1 and subscriptsxyz ``` -------------------------------- ### HTML: Implicit Label Usage Example Source: https://kelpui.com/docs/forms/label Provides an example of how an implicit label might be used in practice, specifically for a checkbox. While functional, it is noted that explicit association is preferred for accessibility. ```html ``` -------------------------------- ### Cluster Layout Example - HTML Source: https://kelpui.com/docs/layout/cluster Demonstrates the basic usage of the `.cluster` class for creating an inline, evenly spaced layout that wraps to the next line. This is useful for collections of items like tags or image galleries. ```html
Merlin
Gandalf
Radagast and his animals
Wand
Sword
Wizard Staff
The magical secrets of the universe
Potions
Cauldron
Supercalifragilisticexpialidocious
``` -------------------------------- ### Kelp UI Container Sizes Example (HTML) Source: https://kelpui.com/docs/layout/container Demonstrates the usage of Kelp UI's container classes to center content and restrict its maximum width. These classes provide predefined responsive breakpoints for various screen sizes. ```html
.container-xs
.container-s
.container or .container-m
.container-l
.container-xl
.container-2xl
``` -------------------------------- ### Content Choreography with Start Classes Source: https://kelpui.com/docs/layout/grid Control the order of grid items on larger screens using `.start-*` helper classes. `.start-first` moves an item to the beginning, while `.start-{fraction}` classes position items at specific fractional points within the grid. ```html
1
2
3
1
2
1
2
3
``` -------------------------------- ### KelpUI Inline Code and Preformatted Text Example (HTML/CSS) Source: https://kelpui.com/docs/components/code Demonstrates the usage of KelpUI styles for inline code and preformatted text. It shows how to apply the `.js-example` class for inline code and uses a `
` block for preformatted text. Note that KelpUI does not provide syntax highlighting.

```html
Inline code: .js-example.

/* Preformatted Text */
.js-example {
	color: #272727;
	background: #ffffff;
}
``` -------------------------------- ### Kelp UI Proportional Scaling Example (HTML) Source: https://kelpui.com/docs/getting-started/typography Demonstrates how to apply size scaling to a parent element, affecting all child elements proportionally using 'em' units. Avoids repeated class application on child elements. Compounding 'em' units can lead to unintended larger sizes if not managed carefully. ```html

Hello world!

How are you today?

``` -------------------------------- ### Kelp UI Compounding Size Example (HTML) Source: https://kelpui.com/docs/getting-started/typography Shows how nested size classes in Kelp UI, using 'em' units, can lead to elements becoming larger than intended due to compounded scaling. This highlights a potential pitfall when applying multiple size modifiers. ```html

Hello world!

``` -------------------------------- ### Kelp UI Dropdown Component Example Source: https://kelpui.com/docs/components/dropdown Demonstrates the implementation of a dropdown menu using the `` web component. This component hides content until a toggling element is activated, offering various interactive options within the dropdown. ```html
  • Now you see me...
  • Now you don't!
  • With a link
``` -------------------------------- ### Input with Placeholder Attribute HTML Source: https://kelpui.com/docs/components/text-input Shows how to use the 'placeholder' attribute on an '' element to provide example or guidance text. It's important to note that placeholder text should not replace a '