Skip to content

createStyleContext defaultProps type error for data-* attributes #3401

@amiftachulh

Description

@amiftachulh

Description

When I use data-* attributes in createStyleContext defaultProps, it shows a type error. The rendered HTML output is correct, though.

Image

My current workaround is using type assertion like this.

const TabsList = withContext(TabsPrimitive.List, 'list', {
  defaultProps: {
    'data-slot': 'tabs-list',
  } as Partial<React.ComponentProps<typeof TabsPrimitive.List>>,
});

Link to Reproduction

https://stackblitz.com/edit/vitejs-vite-1ebobrzk?file=src%2Fcomponents%2Fui%2Ftabs.tsx

Steps to reproduce

  1. Go to src/components/ui/tabs.tsx
  2. The type error appears in the defaultProps

JS Framework

React (TS)

Panda CSS Version

1.4.3

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions