Svelte Components

spences10/svelte-skills-kit/plugins/svelte-skills/skills/svelte-components

作者 spences102a9d88379bf62cee464a16db852edda7790a58f5无许可证收录于 2026年10月9日更新于 2026年10月9日

Svelte component patterns. Use for web components, component libraries (Bits UI, Ark UI, Melt UI), form patterns, or third-party integration.

AI 生成的概览

关于 Svelte 组件模式的参考指南,涵盖组件库、Web Components 和表单处理。

功能
提供构建 Svelte 组件的快速参考说明,涵盖 Bits UI、Ark UI、Melt UI 等无样式组件库、自定义元素配置以及表单模式。它指向三个参考文件,分别涉及组件库设置、Web Components 和高级表单处理。产出的是指导内容和代码片段,而非生成的文件。
适用场景
适用于处理 Svelte 组件时,尤其是集成组件库、构建自定义元素或处理表单模式。适合在 Svelte 前端开发过程中快速查阅。
运行要求
不需要脚本或特殊工具,仅为说明和参考文档。应用这些模式时需具备 Svelte 项目环境。

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:

svelte
<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

javascript
// svelte.config.jsexport default {	compilerOptions: {		customElement: true,	},};
svelte
<!-- MyButton.svelte --><svelte:options customElement="my-button" />
<button><slot /></button>

Reference Files

  • component-libraries.md [blocked] - Bits UI, Ark UI setup
  • web-components.md [blocked] - Building custom elements
  • form-patterns.md [blocked] - Advanced form handling

Notes

  • Bits UI 1.0: flexible, unstyled, accessible components for Svelte
  • Form defaultValue attribute enables easy form resets
  • Use snippets to wrap rich HTML in custom select options
  • Last verified: 2025-01-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 -->

来源与署名

来源:spences10/svelte-skills-kit位于plugins/svelte-skills/skills/svelte-components提交2a9d883

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架