Skip to content

Commit

Permalink
toggle group demo
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Nov 30, 2023
1 parent 0ef8567 commit 44840db
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/components/demos/toggle-group-demo.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
<script lang="ts">
import { ToggleGroup } from "$lib";
import { TextB, TextItalic } from "phosphor-svelte";
import { TextB, TextItalic, TextStrikethrough } from "phosphor-svelte";
let value: string[] | undefined = undefined;
let value: string[] | undefined = ["bold"];
</script>

<ToggleGroup.Root bind:value type="multiple">
<ToggleGroup.Root
bind:value
type="multiple"
class="flex h-input items-center gap-x-0.5 rounded-card-sm border border-muted bg-background px-[5px] py-1 shadow-mini"
>
<ToggleGroup.Item
aria-label="toggle bold"
value="bold"
class="inline-flex items-center justify-center rounded-[9px] bg-background transition-all sq-10 hover:bg-muted active:scale-98 data-[state=on]:bg-muted"
class="inline-flex items-center justify-center rounded-[9px] bg-background transition-all sq-10 hover:bg-muted active:scale-98 data-[state=on]:bg-muted"
>
<TextB class="sq-6" />
</ToggleGroup.Item>
<ToggleGroup.Item
aria-label="toggle italic"
value="italic"
class="inline-flex items-center justify-center rounded-[9px] bg-background transition-all sq-10 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-98 data-[state=on]:bg-muted"
class="inline-flex items-center justify-center rounded-[9px] bg-background transition-all sq-10 hover:bg-muted active:scale-98 data-[state=on]:bg-muted"
>
<TextItalic class="sq-6" />
</ToggleGroup.Item>
<ToggleGroup.Item
aria-label="toggle strikethrough"
value="strikethrough"
class="inline-flex items-center justify-center rounded-[9px] bg-background transition-all sq-10 hover:bg-muted active:scale-98 data-[state=on]:bg-muted"
>
<TextStrikethrough class="sq-6" />
</ToggleGroup.Item>
</ToggleGroup.Root>

0 comments on commit 44840db

Please sign in to comment.