Frame Colors
Use brand color for the frame and a contrasting fill for the QR pattern.
Overlay
Demonstrates an overlay with an icon and a contrasting square background to separate it visually from the pattern.
Clickable download
Wrap the visual frame/pattern in the download trigger so clicking the code initiates a download.
Anatomy
Here’s an overview of how the QrCode component is structured in code:
import { QrCode } from '@skeletonlabs/skeleton-react';
export default function Anatomy() {
return (
<QrCode value="https://skeleton.dev">
<QrCode.Frame>
<QrCode.Pattern />
</QrCode.Frame>
<QrCode.Overlay />
<QrCode.DownloadTrigger />
</QrCode>
);
}<script lang="ts">
import { QrCode } from '@skeletonlabs/skeleton-svelte';
</script>
<QrCode value="https://skeleton.dev">
<QrCode.Frame>
<QrCode.Pattern />
</QrCode.Frame>
<QrCode.Overlay />
<QrCode.DownloadTrigger />
</QrCode>API Reference
Root
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | Api<PropTypes> |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | (qrCode: Api<PropTypes>) => ReactNode |
DownloadTrigger
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
Frame
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"svg">) => Element) | undefined Render the element yourself |
Pattern
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"path">) => Element) | undefined Render the element yourself |
Overlay
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Root
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | () => Api<PropTypes> |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | Snippet<[() => Api<PropTypes>]> |
DownloadTrigger
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |
Frame
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"svg">]> | undefined Render the element yourself |
Pattern
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"path">]> | undefined Render the element yourself |
Overlay
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |