### Start Local Development Server
Source: https://github.com/sveltestrap/sveltestrap/blob/main/DEVELOPMENT.md
Starts the local development server to launch the Sveltestrap documentation. Changes are automatically rebuilt and reflected.
```bash
> pnpm start
```
--------------------------------
### Install and Configure Husky Hooks
Source: https://github.com/sveltestrap/sveltestrap/blob/main/DEVELOPMENT.md
Installs husky hooks and ensures they are executable and copied to the .git/hooks directory for pre-commit and post-merge actions.
```bash
> pnpm dlx husky install
> chmod +x .husky/post-merge && chmod +x .husky/pre-commit && cp .husky/post-merge .git/hooks
```
--------------------------------
### Select, Radio, Checkbox, and Switch Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Input/Input.mdx
Provides examples for select dropdowns, radio buttons, checkboxes (including a reversed label option), and switches.
```html
{#each [1, 2, 3, 4, 5] as option}
{/each}
{#each ['eenie', 'meanie', 'minie', 'moe'] as value}
{/each}
```
--------------------------------
### File Input Example with Help Text
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Input/Input.mdx
Shows how to implement a file input and associate it with help text using FormText.
```html
This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line.
```
--------------------------------
### ListGroup Basic Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/ListGroup/ListGroup.mdx
A basic example of the ListGroup component. It requires importing ListGroup and ListGroupItem from '@sveltestrap/sveltestrap'.
```html
Cras justo odioDapibus ac facilisis inMorbi leo risusPorta ac consectetur acVestibulum at eros
```
--------------------------------
### Basic ButtonGroup Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/ButtonGroup/ButtonGroup.mdx
Demonstrates the basic usage of the ButtonGroup component with different colored buttons.
```html
```
--------------------------------
### Install PNPM and Project Dependencies
Source: https://github.com/sveltestrap/sveltestrap/blob/main/DEVELOPMENT.md
Installs the PNPM package manager globally and then installs project dependencies using pnpm.
```bash
> npm install -g pnpm
> pnpm i
```
--------------------------------
### Popover Placement Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Popover/Popover.mdx
Demonstrates how to position Popovers using the 'placement' prop. Supports 'top', 'right', 'left', 'bottom', and 'auto'.
```html
{#each placements as placement, index}
This Popover is using {args.placement} placement.
{/each}
```
--------------------------------
### Basic Modal Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Modal/Modal.mdx
Demonstrates the fundamental usage of the Modal component with a button to toggle its visibility. Requires importing Button and Modal from '@sveltestrap/sveltestrap'.
```html
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
```
--------------------------------
### Sized ButtonGroup Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/ButtonGroup/ButtonGroup.mdx
Illustrates how to apply different sizes (sm, md, lg) to a ButtonGroup and its contained buttons.
```html
{#each sizeMap as size}
{/each}
```
--------------------------------
### Color Input Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Input/Input.mdx
Demonstrates the color input type for selecting a color.
```html
```
--------------------------------
### Install Sveltestrap with npm, pnpm, or yarn
Source: https://github.com/sveltestrap/sveltestrap/blob/main/README.md
Use your preferred package manager to install Sveltestrap and Svelte.
```bash
# npm
> npm install svelte @sveltestrap/sveltestrap
# pnpm
> pnpm install svelte @sveltestrap/sveltestrap
# yarn
> yarn add svelte @sveltestrap/sveltestrap
```
--------------------------------
### Outlined ButtonGroup Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/ButtonGroup/ButtonGroup.mdx
Shows how to create an outlined ButtonGroup using the 'outline' prop on individual buttons.
```html
```
--------------------------------
### Basic Carousel Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Carousel/Carousel.mdx
A standard carousel with navigation and indicators. This example uses a basic setup with predefined items.
```html
{#each items as item, index}
{/each}
```
--------------------------------
### Date and Time Input Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Input/Input.mdx
Illustrates the use of datetime-local, date, and time input types for capturing date and time information.
```html
```
--------------------------------
### Commit Message Type Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/CONTRIBUTING.md
Provides examples of valid commit message types and scopes. Use these to categorize your changes accurately.
```text
chore(package): add Oyster build script
docs(tooltip): explain hat wobble
feat(button): add beta sequence
fix(modal): remove broken confirmation message
refactor(cards): share logic between 4d3d3d3 and flarhgunnstow
style(tabs): convert tabs to spaces
test(table): add column sorting tests
```
--------------------------------
### Popover Theming Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Popover/Popover.mdx
Illustrates how to apply different themes ('light' and 'dark') to Popovers. Each theme is applied to a separate Popover instance triggered by different buttons.
```html
HelloWorld!
You can click inside this Popover and it will not dismiss. Dismissal will only occur if the click is outside of the popover.
HelloWorld!
You can click inside this Popover and it will not dismiss. Dismissal will only occur if the click is outside of the popover.
```
--------------------------------
### Nav Tabs Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Nav/Nav.mdx
Demonstrates the usage of the Nav component with the 'tabs' prop. Includes dropdown functionality and disabled links.
```html
```
--------------------------------
### Basic Text Input Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Input/Input.mdx
Demonstrates various text-based input types like text, email, password, URL, search, and textarea. Includes a plaintext option for static values.
```html
```
--------------------------------
### Fullscreen Modal Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Modal/Modal.mdx
Shows how to make the Modal component occupy the entire screen using the 'fullscreen' prop. A button is provided to trigger the fullscreen modal.
```html
Modal title
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
```
--------------------------------
### Progress Component Theming
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Progress/Progress.mdx
Demonstrates how to use the Progress component with 'dark' and 'light' themes. Includes examples of basic progress, striped, and animated progress bars.
```html
Dark Theme
Light Theme
```
--------------------------------
### Number and Range Input Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Input/Input.mdx
Shows how to create number and range input types. The range input includes min, max, and step attributes.
```html
```
--------------------------------
### FormGroup Basic Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/FormGroup/FormGroup.mdx
Demonstrates the basic usage of the FormGroup component. This snippet is typically used for standard form layouts.
```html
```
--------------------------------
### Navbar with Container and Collapse
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Navbar/Navbar.mdx
A comprehensive Navbar example demonstrating collapse functionality, navigation links, dropdowns, and a container. Requires importing multiple components and managing collapse state.
```html
NavBar with md container (isOpen = !isOpen)} />
```
--------------------------------
### Theme Store Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Theme/Theme.mdx
Directly manipulate the global theme mode using the `$colorMode` store. Assign 'light', 'dark', or 'auto' to change the theme.
```html
```
--------------------------------
### Nav Underline Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Nav/Nav.mdx
Illustrates the 'underline' prop for the Nav component, creating an underline-style navigation. Includes dropdowns and disabled links.
```html
```
--------------------------------
### Vertical ButtonGroup Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/ButtonGroup/ButtonGroup.mdx
Demonstrates how to stack buttons vertically within a ButtonGroup component.
```html
```
--------------------------------
### Theme Customization with Styles Component
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Styles/Styles.mdx
Demonstrates how to use the `theme` attribute of the `` component to set the color mode (light, dark, or auto). This example also shows how to dynamically switch themes using buttons.
```html
MenuAnother ActionAnother Action
```
--------------------------------
### Nav Pills Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Nav/Nav.mdx
Shows how to use the Nav component with the 'pills' prop for a pill-style navigation. Features dropdowns and disabled links.
```html
```
--------------------------------
### Nav Vertical Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Nav/Nav.mdx
Demonstrates the 'vertical' prop for the Nav component, creating a vertical navigation stack. Shows both list-based and link-based approaches.
```html
List Based
Link based
```
--------------------------------
### Button Group Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Button/Button.mdx
Demonstrates how to group multiple buttons together using the ButtonGroup component. Each button within the group can have its own properties.
```html
```
--------------------------------
### Responsive Container Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Container/Container.mdx
Demonstrates the usage of the Container component with different responsive breakpoints (fluid, sm, md, lg, xl, xxl). Each breakpoint class ensures the container is 100% wide until the specified breakpoint is reached.
```html
fluid
sm
md
lg
xl
xxl
```
--------------------------------
### Basic Tabs Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Tabs/Tabs.mdx
Demonstrates the basic structure of the Tabs component with three panes: Alpha, Bravo, and Charlie. The 'active' prop on the first TabPane ensures it is displayed on load.
```html
Alpha
Bravo
Charlie
```
--------------------------------
### Pagination with Dark and Light Theming
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Pagination/Pagination.mdx
Illustrates how to apply different themes to the Pagination component using the 'theme' prop. Shows examples for both 'dark' and 'light' themes.
```html
123123
```
--------------------------------
### Dropdown with Different Sizes
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Dropdown/Dropdown.mdx
Apply different sizes to the dropdown toggle using the 'size' prop. This example iterates through predefined sizes.
```html
{#each sizes as size}
Dropdown {size}Another ActionAnother Action
{/each}
```
--------------------------------
### Modal Sizes Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Modal/Modal.mdx
Illustrates how to control the size of the Modal component using the 'size' prop. Supports 'sm', 'lg', and 'xl' for different modal dimensions. Includes various buttons to trigger different sizes.
```html
Modal title
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
```
--------------------------------
### Button Toolbar Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Button/Button.mdx
Shows how to arrange multiple button groups within a toolbar using the ButtonToolbar component. This is useful for organizing related button actions.
```html
```
--------------------------------
### Popover Trigger Examples
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Popover/Popover.mdx
Illustrates different ways to trigger Popovers, including 'click', 'hover', and 'focus'. Each trigger type is associated with a specific button.
```html
This Popover is shown when clicking on the trigger element.
This Popover is shown while hovering over the trigger element.
This Popover is shown while focusing on the trigger element.
```
--------------------------------
### Theme Hook Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Theme/Theme.mdx
Use the `useColorMode` hook to programmatically set the global theme to 'light', 'dark', or 'auto'. Ensure the necessary imports are included.
```html
```
--------------------------------
### Commit Message Format Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/CONTRIBUTING.md
Illustrates the standard format for commit messages, including type, scope, and subject. Ensure your commits follow this structure for clarity and consistency.
```text
feat(tooltip): add hat wobble
^--^^-------^ ^------------^
| | |
| | +-> Summary in present tense.
| |
| +------> Scope of the change (page, component, util, etc.)
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
```
--------------------------------
### Controlled Alert Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Alert/Alert.mdx
Demonstrates controlling the visibility of an alert component programmatically using the `isOpen` prop and a `toggle` function. The alert can be dismissed by updating the `isOpen` state.
```html
(isOpen = false)}>
I can be controlled via isOpen and toggle.
```
--------------------------------
### Offcanvas Placement Options
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Offcanvas/Offcanvas.mdx
Illustrates how to position the Offcanvas component on different sides of the screen ('start', 'end', 'top', 'bottom') using the `placement` prop. Multiple offcanvases are managed simultaneously.
```html
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
```
--------------------------------
### Basic Static Validation Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Validation/Validation.mdx
Demonstrates static invalid and valid feedback for form inputs. Ensure the 'invalid' or 'valid' props are set on the Input component along with the 'feedback' prop.
```html
```
--------------------------------
### Responsive Table Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Table/Table.mdx
Enable horizontal scrolling for tables by setting the `responsive` prop to `true`. This is useful for tables with many columns that might otherwise overflow their containers.
```html
#
{#each Array(15) as _, count}
Header {count + 1}
{/each}
1
{#each Array(15) as _, count}
Cell {count + 1}
{/each}
2
{#each Array(15) as _, count}
Cell {count + 1}
{/each}
3
{#each Array(15) as _, count}
Cell {count + 1}
{/each}
```
--------------------------------
### Basic Icon Usage
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Icon/Icon.mdx
Demonstrates the basic usage of the Icon component. Ensure you have imported the necessary components.
```svelte
```
--------------------------------
### Scrollable Offcanvas
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Offcanvas/Offcanvas.mdx
Configures an Offcanvas component to allow scrolling within its body content. The backdrop is disabled for this example.
```html
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
// ... a bunch more content
```
--------------------------------
### Nav Component Theming
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Nav/Nav.mdx
Demonstrates how to apply 'dark' and 'light' themes to the Nav component. Ensure Nav, NavItem, and NavLink are imported from '@sveltestrap/sveltestrap'.
```html
```
--------------------------------
### Dismissible Popover Example
Source: https://github.com/sveltestrap/sveltestrap/blob/main/src/Popover/Popover.mdx
Shows a Popover that can be dismissed by any click event. It includes a custom title slot with HTML content.
```html
HelloWorld!
This Popover is dismissesed when any click occurs.
```
--------------------------------
### Run Integration Tests with Report
Source: https://github.com/sveltestrap/sveltestrap/blob/main/DEVELOPMENT.md
Executes all integration tests and launches a report.
```bash
> pnpm test:integration:report
```
--------------------------------
### Run All Integration Tests
Source: https://github.com/sveltestrap/sveltestrap/blob/main/DEVELOPMENT.md
Executes all integration tests.
```bash
> pnpm test:integration
```