mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-10 03:49:20 +00:00
feat: add required indicator for required inputs (#993)
This commit is contained in:
@@ -5,16 +5,25 @@
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
class: className,
|
||||
required = false,
|
||||
children,
|
||||
...restProps
|
||||
}: LabelPrimitive.RootProps = $props();
|
||||
}: LabelPrimitive.RootProps & {
|
||||
required?: boolean;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<LabelPrimitive.Root
|
||||
bind:ref
|
||||
data-slot="label"
|
||||
class={cn(
|
||||
'mb-3 flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
||||
'mb-3 flex items-center gap-1.5 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
||||
required && "after:text-[14px] after:text-red-500 after:content-['*']",
|
||||
className
|
||||
)}
|
||||
{...restProps}
|
||||
/>
|
||||
>
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{/if}
|
||||
</LabelPrimitive.Root>
|
||||
|
||||
Reference in New Issue
Block a user