Components
ShadCN Components
Installing and using ShadCN components in your SvelteLaunch application
Introduction
shadcn-svelte is a collection of customizable UI components for Svelte applications. This guide will walk you through the process of installing and using shadcn-svelte components in your SvelteLaunch project.
Adding Components
To add a shadcn-svelte component to your project:
Use the shadcn-svelte CLI to add the desired component:
Replace
[component-name]
with the name of the component you want to add (e.g.,button
,card
,accordion
).The component and its dependencies will be added to your project in the
src/lib/components/ui
directory.
Using Components
To use a shadcn-svelte component in your SvelteLaunch project:
Import the component from the
$lib/components/ui
directory:Use the component in your Svelte template:
Customizing Components
shadcn-svelte components are designed to be easily customizable. To modify a component:
Locate the component file in the
src/lib/components/ui
directory.Open the component file and modify the styles or behavior as needed.
For styling changes, you can modify the Tailwind CSS classes directly in the component file.
For more extensive customizations, you can create a new component that extends the base shadcn-svelte component.
Example of customizing a Button component:
Available Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Button
- Calendar
- Card
- Carousel
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Form
- Hover Card
- Input
- Label
- Menubar
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
For detailed information on each component, including props, usage examples, and customization options, click on the component name to visit its documentation page. Each link will open in a new tab.