Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

CustomButtonLink.tsx

22 lines743 Bytes

1import React from 'react'
2import { createLink } from '@tanstack/react-router'
3import { Button } from '@mui/material'
4import type { ButtonProps } from '@mui/material'
5import type { LinkComponent } from '@tanstack/react-router'
6​
7interface MUIButtonLinkProps extends ButtonProps<'a'> {
8 // Add any additional props you want to pass to the Button
9}
10​
11const MUIButtonLinkComponent = React.forwardRef<
12 HTMLAnchorElement,
13 MUIButtonLinkProps
14>((props, ref) => <Button ref={ref} component="a" {...props} />)
15​
16const CreatedButtonLinkComponent = createLink(MUIButtonLinkComponent)
17​
18export const CustomButtonLink: LinkComponent<typeof MUIButtonLinkComponent> = (
19 props,
20) => {
21 return <CreatedButtonLinkComponent preload={'intent'} {...props} />