Refine AI
This is documentation for Refine 4.xx.xx, which is no longer actively maintained.
For up-to-date documentation, see the latest version (5.xx.xx).
Version: 4.xx.xx
Swizzle Ready
This field is used to display the email values. It uses the <Link> component of <Typography> from Material UI.
Good to know:
You can swizzle this component with the Refine CLI to customize it.
Usage
Let's see how we can use <EmailField> with the example in the user list:
localhost:3000/users
Live previews only work with the latest documentation.
import {
  useDataGrid,
  List,
  EmailField,
} from "@refinedev/mui";
import { DataGrid, GridColDef } from "@mui/x-data-grid";
const columns: GridColDef[] = [
  { field: "id", headerName: "ID", type: "number" },
  { field: "firstName", headerName: "First Name", minWidth: 80 },
  { field: "lastName", headerName: "Last Name", minWidth: 80 },
  {
    field: "email",
    headerName: "Email Address",
    display: "flex",
    renderCell: function render({ row }) {
      return <EmailField value={row.email} />;
    },
    minWidth: 100,
    flex: 1,
  },
];
const UsersList: React.FC = () => {
  const { dataGridProps } = useDataGrid<IUser>();
  return (
    <List>
      <DataGrid {...dataGridProps} columns={columns} />
    </List>
  );
};
interface IUser {
  id: number;
  firstName: string;
  lastName: string;
  email: string;
}
Implementation Tips:
<EmailField> uses "mailto:" in the href prop of the <Link> component. For this reason, clicking <EmailField> opens your device's default mail application.
Was this helpful?
API Reference
Properties
| Property | Type | Description | 
|---|---|---|
value ﹡  |  | The value of the field.  | 
External Props:
It also accepts all props of Material UI Link.
Was this helpful?