Skip to content

Commit

Permalink
use $$restProps in Textarea atom (#56)
Browse files Browse the repository at this point in the history
Add `$$restProps.class` to the `cn(...)` in Textarea atom
  • Loading branch information
shannonwells authored Nov 13, 2024
1 parent babe5fe commit a3a8768
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/lib/atoms/Textarea.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,13 @@
>
<Textarea {label} {placeholder} {isRequired} {value} {error} />
</Story>

<!-- Extra classes Example -->
<Story
name="Textarea + Class"
args={{
label: 'Textarea with extra classes',
}}
>
<Textarea {label} {placeholder} {value} class="h-f160"></Textarea>
</Story>
3 changes: 2 additions & 1 deletion src/lib/atoms/Textarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<textarea
class={cn(
'border-input aria-[invalid]:border-destructive data-[placeholder]:[&>span]:text-muted-foreground sm flex h-10 w-full max-w-[388px] items-center justify-between rounded-md border bg-white px-3 py-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
error ? 'border-2 border-error' : 'border border-gray3'
error ? 'border-2 border-error' : 'border border-gray3',
$$restProps.class
)}
{placeholder}
bind:value
Expand Down

0 comments on commit a3a8768

Please sign in to comment.