Skip to content

Is it possible to extend components with variants? #74

Answered by cschroeter
kaumac asked this question in Q&A
Discussion options

You must be logged in to vote

@kaumac

That are useful additions to Park / Ark UI and we have both FormControl and loadings states on the roadmap.
How ever you can defintively start ahead.

For the Input state I would recommend using build in conditions like invalid to get the job done. The input recipe could look something like this:

import { defineRecipe } from '@pandacss/dev'

export const input = defineRecipe({
  className: 'input',
  base: {},
  defaultVariants: {
    size: 'md',
    variant: 'outline',
  },
  variants: {
    outline: {
      base: {
        _invalid: {
          borderColor: 'border.danger',
          boxShadow: 'danger',
        },
      },
    },
  },
})

For the button it kinda depends how a loa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kaumac
Comment options

Answer selected by kaumac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants