Type errors in latest beta

Author: nikischinCreated Jun 22, 2025Updated Aug 22, 2025
Labelsbug

Prerequisites

Describe the bug

The latest beta versions are great! Especially since #6927 is fixing an annoying flickering issue we had.

Unfortunately with the latest beta you changed how types work. I implemented some custom components like this:

bash
import React from 'react';
import { Button, ButtonProps } from 'react-bootstrap';
import { To, useNavigate } from 'react-router';

interface LinkButtonProps extends ButtonProps {
    to?: To;
    href?: string;
}

export default function LinkButton({ to, href, ...props }: LinkButtonProps): React.ReactElement {
    const navigate = useNavigate();

    return (
        <Button
            {...props}
            onClick={(e: React.MouseEvent) => {
                e.preventDefault();

                if (to) {
                    navigate(to);
                } else {
                    window.open(href);
                }
            }}
        />
    );
}

In the latest beta with an implementation like this:

<LinkButton variant='icon-text' className='icon-sample' to={someDestination}>Some Label</LinkButton>

I will get type errors which I wouldn't get with earlier versions. I am told, that both children and className would not exist in my component.

The issue seems to be I am using the ButtonProps (what used to work before) which no longer inherit the className and other base props. Most likely I would be able to work around the issue by using DynamicRefForwardingComponent from @restart/ui but I personally feel like it does mess up my code quite a bit.

Is this supposed to be a breaking change and the new desired behavior or might this get fixed again?

Thank you so much!

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Visual Studio Code

What version of React-Bootstrap are you using?

3.0.0-beta.2

What version of Bootstrap are you using?

5.3.8

Additional context

Typescript 5.8.3

Source: react-bootstrap/react-bootstrap