Form Label
A text component that provides information about another component.
import { defineConfig } from '@pandacss/dev'
import { createPreset } from '@park-ui/panda-preset'
export default defineConfig({
preflight: true,
presets: [
'@pandacss/preset-base',
createPreset({
accentColor: '__ACCENT_COLOR__',
grayColor: '__GRAY_COLOR__',
borderRadius: '__BORDER_RADIUS__',
}),
],
include: ['./src/**/*.{js,jsx,ts,tsx}'],
jsxFramework: '__JS_FRAMEWORK__',
outdir: 'styled-system',
})
import { parkwindPlugin } from '@park-ui/tailwind-plugin'
import type { Config } from 'tailwindcss'
const config: Config = {
content: ['./src/**/*.{astro,html,js,jsx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
},
plugins: [parkwindPlugin],
parkUI: {
accentColor: '__ACCENT_COLOR__',
grayColor: '__GRAY_COLOR__',
borderRadius: '__BORDER_RADIUS__',
},
darkMode: ['class'],
}
export default config
import { FormLabel, type FormLabelProps } from '~/components/ui/form-label'
export const Demo = (props: FormLabelProps) => {
return <FormLabel {...props}>I'm a label</FormLabel>
}
Insert code snippet into your project. Update import paths as needed.
import { ark, type HTMLArkProps } from '@ark-ui/react/factory'
import { forwardRef } from 'react'
import { tv, type VariantProps } from 'tailwind-variants'
export interface FormLabelProps extends FormLabelVariantProps, HTMLArkProps<'label'> {}
export const FormLabel = forwardRef<HTMLLabelElement, FormLabelProps>((props, ref) => {
const { size, className, ...rest } = props
return <ark.label className={styles({ size, className })} ref={ref} {...rest} />
})
FormLabel.displayName = 'FormLabel'
type FormLabelVariantProps = VariantProps<typeof styles>
const styles = tv(
{
base: 'formLabel',
defaultVariants: { size: 'md' },
variants: {
size: {
sm: 'formLabel--size_sm',
md: 'formLabel--size_md',
lg: 'formLabel--size_lg',
xl: 'formLabel--size_xl',
},
},
},
{ twMerge: false },
)
import { type HTMLArkProps, ark } from '@ark-ui/solid'
import { splitProps } from 'solid-js'
import { type VariantProps, tv } from 'tailwind-variants'
export interface FormLabelProps extends FormLabelVariantProps, HTMLArkProps<'label'> {}
export const FormLabel = (props: FormLabelProps) => {
const [variantProps, formLabelProps] = splitProps(props, ['class', 'size'])
return <ark.label class={styles(variantProps)} {...formLabelProps} />
}
type FormLabelVariantProps = VariantProps<typeof styles>
const styles = tv(
{
base: 'formLabel',
defaultVariants: { size: 'md' },
variants: {
size: {
sm: 'formLabel--size_sm',
md: 'formLabel--size_md',
lg: 'formLabel--size_lg',
xl: 'formLabel--size_xl',
},
},
},
{ twMerge: false },
)
Not yet available
Previous
File UploadNext
Hover Card