svelte-components
Build Svelte components. Use for Svelte custom elements, component libraries (Bits UI, Ark UI, Melt UI), form patterns, or third-party integration.
- License 许可
- MIT
- 最近更新
- 2026-08-04
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- svelte-components
- metadata
- { "last_updated": "2026-05-14", "verified_against": "Svelte 5 official docs and current local skill refresh" }
- description
- Build Svelte components. Use for Svelte custom elements, component libraries (Bits UI, Ark UI, Melt UI), form patterns, or third-party integration.
02 资源文件 3
- 参考文档references/component-libraries.md2.0 KB
- 参考文档references/form-patterns.md3.0 KB
- 参考文档references/web-components.md2.2 KB
03 SKILL.md 正文
Svelte Components
Quick Start
Component libraries: Bits UI (headless) | Ark UI | Melt UI (primitives)
Form trick: Use form attribute when form can't wrap inputs:
<form id="my-form" action="/submit"><!-- outside table --></form>
<table>
<tr>
<td><input form="my-form" name="email" /></td>
<td><button form="my-form">Submit</button></td>
</tr>
</table>
Web Components
// svelte.config.js
export default {
compilerOptions: {
customElement: true,
},
};
<!-- MyButton.svelte -->
<svelte:options customElement="my-button" />
<!-- Native <slot> is appropriate inside custom elements. -->
<button><slot /></button>
Reference Files
- component-libraries.md - Bits UI, Ark UI setup
- web-components.md - Building custom elements
- form-patterns.md - Advanced form handling
Notes
- Bits UI 1.0: flexible, unstyled, accessible components for Svelte
- Form
defaultValueattribute enables easy form resets - Use snippets to wrap rich HTML in custom select options
- Use snippets/
{@render}for normal Svelte component content; native<slot>is for custom elements - Last verified: 2026-05-14
<!-- PROGRESSIVE DISCLOSURE GUIDELINES:
- Keep this file ~50 lines total (max ~150 lines)
- Use 1-2 code blocks only (recommend 1)
- Keep description <200 chars for Level 1 efficiency
- Move detailed docs to references/ for Level 3 loading
- This is Level 2 - quick reference ONLY, not a manual -->
04 同仓库更多 Skills
sveltekit-structure
SvelteKit structure guidance. Use for routing, layouts, error handling, SSR, or svelte:boundary. Covers file naming, nested layouts, error boundaries, pending UI, and hydration.
sveltekit-data-flow
SvelteKit data flow guidance. Use when working with load functions, form actions, server/client boundaries, serialization, or invalidation.
svelte-template-directives
Svelte template directive guidance. Use when working with snippets, attachments, dynamic HTML, declaration tags, debugging tags, or global DOM events.
svelte-styling
Svelte CSS styling patterns. Use for scoped styles, CSS custom properties, style: directive, :global, or styling child components.
svelte-runes
Implement Svelte 5 runes correctly. Use for reactive state, props, effects, $state.raw, $derived.by, $props, and $bindable.
svelte-layerchart
Build Svelte LayerChart components. Use for tooltip snippets, Chart context access, gradients, highlights, axes, and Svelte 5 snippet patterns.