mui-toolpad
mui-toolpad copied to clipboard
Add a Link component
Should at the very least support
- href
- text
In the meantime, it can be implemented with a custom component:
import * as React from "react";
import { Link as MUILink } from "@mui/material";
import { createComponent } from "@mui/toolpad-core";
export interface LinkProps {
value: string;
href: string;
}
function Link({ value, href }: LinkProps) {
return (
<MUILink href={href} target="_blank">
{value}
</MUILink>
);
}
export default createComponent(Link, {
argTypes: {
value: {
typeDef: { type: "string" },
defaultValue: "",
},
href: {
typeDef: { type: "string" },
defaultValue: "",
},
},
});
One of #78
In the meantime, it can be implemented with a custom component:
A few notes:
- If only
value
is provided, the link would open the current page, it can be quite confusing. Maybe it's better to do nothing. Not sure. - We probably want to support links that is button https://mui.com/material-ui/react-link/#accessibility