Skip to content

Commit 32383cd

Browse files
committed
docs(LinearGradient): Add explicit offsets example
1 parent da13b6b commit 32383cd

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

  • packages/layerchart/src/routes/docs/components/LinearGradient

packages/layerchart/src/routes/docs/components/LinearGradient/+page.svelte

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,51 @@
4545
</div>
4646
</Preview>
4747

48+
<h2>Explicit offsets</h2>
49+
50+
<Preview>
51+
<div class="h-[334px] p-4 border rounded-sm">
52+
<Chart>
53+
<Layer type={renderContext}>
54+
<LinearGradient
55+
stops={[
56+
['30%', 'hsl(60 100% 50%)'],
57+
['70%', 'hsl(30 100% 40%)'],
58+
]}
59+
>
60+
{#snippet children({ gradient })}
61+
<Rect x={120 * 0} y={0} width={100} height={300} rx={8} fill={gradient} />
62+
{/snippet}
63+
</LinearGradient>
64+
65+
<LinearGradient
66+
stops={[
67+
['10%', 'hsl(60 100% 50%)'],
68+
['90%', 'hsl(140 100% 40%)'],
69+
]}
70+
rotate={45}
71+
>
72+
{#snippet children({ gradient })}
73+
<Rect x={120 * 1} y={0} width={100} height={300} rx={8} fill={gradient} />
74+
{/snippet}
75+
</LinearGradient>
76+
77+
<LinearGradient
78+
stops={[
79+
['50%', 'hsl(195 100% 50%)'],
80+
['50%', 'hsl(270 100% 30%)'],
81+
]}
82+
vertical
83+
>
84+
{#snippet children({ gradient })}
85+
<Rect x={120 * 2} y={0} width={100} height={300} rx={8} fill={gradient} />
86+
{/snippet}
87+
</LinearGradient>
88+
</Layer>
89+
</Chart>
90+
</div>
91+
</Preview>
92+
4893
<h2>Tailwind colors</h2>
4994

5095
<Preview>

0 commit comments

Comments
 (0)