);
}
export default App;
```
--------------------------------
### Configure Tailwind for Storefront UI (Vite)
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
Modifies the `tailwind.config.js` file to include Storefront UI's Tailwind preset and configure the content paths for Tailwind to scan your Vue files and the Storefront UI package.
```typescript
// tailwind.config.js
import { tailwindConfig } from '@storefront-ui/vue/tailwind-config';
/** @type {import('tailwindcss').Config} */
export default {
presets: [tailwindConfig],
content: ['./index.html', './**/*.vue', './node_modules/@storefront-ui/vue/**/*.{js,mjs}'],
theme: {
extend: {},
},
plugins: [],
};
```
--------------------------------
### Install Storefront UI Typography Plugin
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/3.customization/typography.md
Installs the @storefront-ui/typography plugin using package managers like npm, yarn, or pnpm. This is the first step to integrate typography utilities into your project.
```bash
# npm
npm i -D @storefront-ui/typography
# yarn
yarn add -D @storefront-ui/typography
# pnpm
pnpm add -D @storefront-ui/typography
```
--------------------------------
### Add Tailwind Directives to CSS
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/react.md
Includes the necessary Tailwind CSS directives (`@tailwind base`, `@tailwind components`, `@tailwind utilities`) in the main CSS file to apply Tailwind's styles.
```css
/* src/style.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
```
--------------------------------
### Configure Nuxt for Storefront UI
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
Adds the `@storefront-ui/nuxt` module to your `nuxt.config.ts` file to enable Storefront UI and its Tailwind CSS integration within your Nuxt 3 application.
```typescript
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@storefront-ui/nuxt']
})
```
--------------------------------
### Configure Astro Tailwind CSS with Storefront UI Preset
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
This JavaScript configuration file (`tailwind.config.cjs`) integrates the Storefront UI Tailwind preset into an Astro project. It merges the preset with project-specific content paths and theme extensions for a unified styling approach.
```javascript
const { tailwindConfig } = require('@storefront-ui/vue/tailwind-config');
/** @type {import('tailwindcss').Config} */
module.exports = {
presets: [tailwindConfig],
content: ['./index.html', './src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}', './node_modules/@storefront-ui/vue/**/*.{js,mjs}'],
theme: {
extend: {},
},
plugins: [],
};
```
--------------------------------
### Basic Usage Example
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/dropdown.md
Demonstrates the default behavior of the SfDropdown component, where the floating content is positioned below the trigger element. This example showcases the component's fundamental functionality.
```vue
<<<../../../../preview/nuxt/pages/showcases/Dropdown/BasicDropdown.vue
```
```react
<<<../../../../preview/next/pages/showcases/Dropdown/BasicDropdown.tsx
```
--------------------------------
### Add Tailwind CSS Directives
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
Adds the necessary Tailwind CSS directives (`@tailwind base`, `@tailwind components`, `@tailwind utilities`) to your main CSS file, enabling Tailwind's styles and Storefront UI's integration.
```css
/* src/style.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
```
--------------------------------
### Install Storefront UI Peer Next Plugin
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/packages/sfui/tw-plugin-peer-next/README.md
Install the `@storefront-ui/tw-plugin-peer-next` package using npm. This plugin enhances Tailwind CSS by allowing styling of adjacent siblings.
```bash
npm install --save-dev @storefront-ui/tw-plugin-peer-next
```
--------------------------------
### Link Variants Example
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/link.md
Demonstrates the usage of the SfLink component with its 'primary' and 'secondary' variants.
```react
<<<<../../../../preview/next/pages/showcases/Link/LinkVariants.tsx
```
--------------------------------
### Link Variants Example
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/link.md
Demonstrates the usage of the SfLink component with its 'primary' and 'secondary' variants.
```vue
<<<<../../../../preview/nuxt/pages/showcases/Link/LinkVariants.vue
```
--------------------------------
### Basic Search with Autocomplete
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_blocks/Search.md
Demonstrates the basic Search component with live autocomplete suggestions. This example uses mock data for suggestions and is suitable for showcasing the core functionality and keyboard accessibility.
```vue
);
};
export default SearchBasic;
```
--------------------------------
### Badge Basic Usage Example
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/badge.md
Demonstrates the basic usage of the SfBadge component, requiring a relative container. Shows how to use the 'dot' variant and the 'max' prop for numeric content.
```vue
import { SfBadge } from '@storefront-ui/vue';
export default {
components: {
SfBadge
}
};
```
```react
import { SfBadge } from '@storefront-ui/react';
export default function MyComponent() {
return (
<>
{/* Basic usage */}
{/* Dot variant */}
{/* Max limit */}
>
);
}
```
--------------------------------
### SelectDropdown Basic Usage
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_blocks/SelectDropdown.md
Demonstrates the basic usage of the SelectDropdown component with a preselected option. This example shows how to initialize the dropdown with a default value, providing a starting point for user interaction.
```vue
import { SfSelect } from '@storefront-ui/vue';
export default {
components: {
SfSelect
},
data() {
return {
selectedOption: 'Option 2'
};
}
};
```
```react
import React, { useState } from 'react';
import { SfSelect } from '@storefront-ui/react';
const SelectDropdownPreselected = () => {
const [selectedOption, setSelectedOption] = useState('Option 2');
return (
setSelectedOption(e.target.value)}
>
);
};
export default SelectDropdownPreselected;
```
--------------------------------
### SfTooltip API Documentation
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/tooltip.md
Comprehensive API documentation for the SfTooltip component, detailing its available props, their types, default values, and possible options, as well as its slots.
```apidoc
SfTooltip Component API:
Props:
label: string (required)
Description: The text content to be displayed in the tooltip.
Default value: undefined
showArrow: boolean
Description: Controls the visibility of the tooltip arrow.
Default value: false
placement: SfPopoverPlacement
Description: Defines the position of the tooltip relative to its target element. Accepts values from SfPopoverPlacement.
Default value: undefined
arrowSize: "${number}px" | "${number}em" | "${number}rem"
Description: Specifies the size of the tooltip arrow. Can be a number followed by 'px', 'em', or 'rem'.
Default value: undefined
children: ReactNode (React only)
Description: The content that the tooltip describes.
Default value: undefined
Slots:
default: Content being described by the tooltip.
Description: The default slot content is the element that the tooltip will be attached to and describe.
```
--------------------------------
### SfInput Component API Documentation
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/input.md
Comprehensive API documentation for the SfInput component, detailing its props, slots, and events across different frameworks. This includes type definitions, default values, possible values, and descriptions for each property and slot.
```APIDOC
SfInput Component API Documentation
Props:
- size: (SfInputSize) Controls the visual size of the input. Possible values: 'sm', 'base', 'lg'. Default: 'base'.
- invalid: (boolean) Indicates if the input has an invalid state. Default: false.
- wrapperTag: (string) Specifies the HTML tag for the input wrapper. Default: 'span'.
- wrapperAs: (string) Alias for wrapperTag, specifically for React. Default: 'span'.
- className: (string) Custom CSS class for the input element (React only).
- slotPrefix: (ReactNode) Content to be rendered in the prefix slot (React only).
- slotSuffix: (ReactNode) Content to be rendered in the suffix slot (React only).
Slots:
- prefix: Custom content for the prefix area of the input.
- suffix: Custom content for the suffix area of the input.
Events:
- update:modelValue: Emitted when the input's value changes, used for v-model binding in Vue.
```
--------------------------------
### Add Tailwind Directives to Nuxt CSS
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
Demonstrates how to set up a custom Tailwind CSS file in a Nuxt.js application. It includes the essential `@tailwind` directives for base, components, and utilities layers, which are necessary for Tailwind to function correctly.
```css
/* ~/assets/css/tailwind.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
```
--------------------------------
### Import and Use SfButton in Astro with Vue
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
Demonstrates how to import a Storefront UI Vue component, SfButton, and use it directly within an Astro component. This allows leveraging Vue's component model within the Astro framework.
```vue
---
import { SfButton } from '@storefront-ui/vue';
---
Hello
```
--------------------------------
### Running Coverage Tests
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/packages/tests/README.md
Provides commands for checking code coverage, which is currently implemented only for Vue. It includes instructions for running coverage locally for all tests or specific files using environment variables.
```bash
# Run all Vue coverage tests from root
yarn test:ci:vue
# Run all coverage tests from apps/preview/vue
yarn test:ci
# Run coverage for a single test file (e.g., SfAlert)
SPEC=SfAlert yarn test:ci
```
--------------------------------
### Configure Nuxt Tailwind CSS
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
This snippet shows how to configure Tailwind CSS within a Nuxt.js project using the `nuxt.config.ts` file. It specifies the content paths for Tailwind to scan for classes, ensuring proper utility class detection.
```typescript
import type { Config } from 'tailwindcss';
export default {
content: ['./**/*.vue'],
};
```
--------------------------------
### Generate Icons with Yarn
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/packages/sfui/README.md
This command sequence is used to generate icons for the project. First, install dependencies using `yarn`, then run `yarn generate-icons` to process assets and create the necessary icon files.
```shell
yarn
yarn generate-icons
```
--------------------------------
### Add Tailwind Directives to Astro CSS
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/2.getting-started/vue.md
This snippet shows how to add the necessary Tailwind CSS directives to the main CSS file (`src/style.css`) in an Astro project. Including `@tailwind base`, `@tailwind components`, and `@tailwind utilities` ensures that Tailwind's styles are applied correctly.
```css
/* src/style.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
```
--------------------------------
### SfTooltip Source Code
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/tooltip.md
Provides the source code for the SfTooltip component, allowing developers to inspect its implementation details for both Vue and React frameworks.
```vue
<<<../../../../../packages/sfui/frameworks/vue/components/SfTooltip/SfTooltip.vue
```
```react
<<<../../../../../packages/sfui/frameworks/react/components/SfTooltip/SfTooltip.tsx
```
--------------------------------
### Animated Accordion Example
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/accordionitem.md
Illustrates how to add smooth transitions to the SfAccordionItem component for a better user experience. This example focuses on the visual animation of the expand/collapse action.
```vue
<<../../../../preview/nuxt/pages/showcases/AccordionItem/AccordionAnimate.vue
```
```react
<<../../../../preview/next/pages/showcases/AccordionItem/AccordionAnimate.tsx
```
--------------------------------
### Basic SfDrawer Usage (React)
Source: https://github.com/vuestorefront/storefront-ui/blob/v2-develop/apps/docs/components/content/_components/drawer.md
Demonstrates the basic usage of SfDrawer in React, controlling its open/close state using the `open` prop and handling the `onClose` event. It highlights the `placement` prop for positioning.
```react
<<<../../../../preview/next/pages/showcases/Drawer/Placement.tsx
```