Skip to content

Cannot set Button type prop #3641

@Aulos

Description

@Aulos

Bug report

Current behavior

I cannot set type prop for a Button component.

<Button type="submit" {...props}>
     {children}
</Button>
error TS2322: Type '{ children: string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...> | null; ... 288 more ...; ref?: Ref<...> | undefined; } | { ...; }' is not assignable to type 'IntrinsicAttributes & (ButtonProps & RefAttributes<HTMLElement>)'.
  Type '{ children: string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...> | null; ... 280 more ...; type: "submit"; }' is not assignable to type 'IntrinsicAttributes & (ButtonProps & RefAttributes<HTMLElement>)'.
    Property 'type' does not exist on type 'IntrinsicAttributes & ButtonNonNativeProps & RefAttributes<HTMLElement>'.

37       <Button type="submit" {...props}>
                 ~~~~

Expected behavior

I should be able to set it:

Image

Reproducible example

I am not sure how to provide an example.

Base UI version

v1.0.0

Which browser are you using?

N/A (it's happening during type checking)

Which OS are you using?

Mac OS

Which assistive tech are you using (if applicable)?

None

Additional context

I was trying the Shadcn create, but I get the same error when I am using the "native" BaseUI Button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions