Very simple component library made in Svelte v5 and Tailwind v4. The point of this for me was to test out what each update is bringing to the table. I also intend on using these components to do quick mockup UIs and projects, hence the name.
I tried keeping a consistent design language across all components, primarily ones that are interactable (form components).
transparent
so they don't shrink in sizenot-allowed
I have tried to make it so components make use of Svelte v5's new feature, Snippets, wherever they can. These effectively allow for passing Svelte code as arguments, but I avoided that where I could.
MockButton
In some component's cases, they accept children in place of the label
attribute.
<!-- This is valid -->
<MockButton>Label</MockButton>
<!-- But I prefer this way unless you need HTML -->
<MockButton label="Label" />
If you need to pass in some fancily styled elements it's worth noting that all components that render children have the group/<component>
Tailwind class on them. In MockButton
's case, it is group/button
.
MockInput
MockInput
allows you to pass snippets to render buttons or icons on the left or right side of the input field.
{#snippet right()}
<Icon
class="size-6"
data={faX}
/>
{/snippet}
<MockInput {right} />
All unknown props passed to a component are passed to the target component element. Which means, aside from wrapper elements, you aren't missing access to any attributes on mock components.
class
AttributeAll classes passed into class
on all components are merged with tailwind-merge
on the primary visual element of the component.
All components are designed to be keyboard accessible, by keeping them as simple and as close to their original counterparts as possible. All components work with plain <form>
tags.