<BaseSnack />
· A small piece of removable info.
<template>
<BaseSnack label="Label" />
</template>
This is a self closing component that can be used to display a small piece of removable info.
<template>
<BaseSnack />
</template>
This component has props that you can use to modify its visual style.
Prop | Type |
---|---|
label default: "" | string The text to display in the snackbar. |
icon default: - | string An optional icon to display in the snackbar. |
image default: - | string An optional image to display in the snackbar. |
variant default: "default" | "default" | "primary" | "dark" | "none" | "muted" The variant of snack. |
size default: "md" | "md" | "xs" | "sm" The size of the snack. |
as-child default: - | boolean Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
as default: - | AsTag | Component The element or component this component should render as. Can be overwritten by `asChild`. |
Event | Emitted Value Type |
---|---|
delete | [] |
Slot | Type |
---|---|
#default | any |
#icon | any |
Your can override the component default CSS variables in your main.css
file.
@theme {
/* Tag default variables */
--color-tag-default-bg: var(--color-white);
--color-tag-default-border: var(--color-muted-400);
--color-tag-default-text: var(--color-muted-400);
/* Tag muted variables */
--color-tag-muted-bg: var(--color-muted-400);
--color-tag-muted-border: var(--color-muted-400);
--color-tag-muted-text: var(--color-muted-400);
/* Tag dark variables */
--color-tag-dark-bg: var(--color-muted-900);
--color-tag-dark-border: var(--color-muted-900);
--color-tag-dark-text: var(--color-muted-900);
}
Use the size
prop to change size of the snack.
<template>
<BaseSnack label="React" color="default" size="xs" />
<BaseSnack label="Angular" color="default" size="sm" />
<BaseSnack label="Vue" color="default" size="md" />
</template>
Use the variant
prop to change color of the snack. Set it to none
to remove the default color and apply your own.
<template>
<BaseSnack
label="Label"
variant="default"
/>
<BaseSnack
label="Label"
variant="muted"
/>
<BaseSnack
label="Label"
variant="dark"
/>
<BaseSnack
label="Label"
variant="none"
class="text-primary-600 bg-primary-500/10 ring-1 ring-primary-600"
/>
</template>
Use the icon
prop to display an icon inside the snack.
<template>
<BaseSnack
label="React"
variant="default"
icon="logos:react"
/>
</template>
Use the image
prop to display an image inside the snack.
<template>
<BaseSnack
label="Mike"
variant="default"
size="xs"
image="/img/people/19.jpg"
/>
</template>