Skip to main content
Refine AI
Version: 4.xx.xx
Swizzle Ready

Text

This field lets you show basic text. It uses Mantine <Text> component.

Good to know:

You can swizzle this component to customize it with the Refine CLI

Usage

Let's see how to use it in a basic show page:

localhost:3000/posts/show/123
import { useShow, useOne } from "@refinedev/core";
import { Show, TextField } from "@refinedev/mantine";
import { Title, Text } from "@mantine/core";

const PostShow: React.FC = () => {
const { queryResult } = useShow<IPost>();
const { data, isLoading } = queryResult;
const record = data?.data;

const { data: categoryData, isLoading: categoryIsLoading } =
useOne<ICategory>({
resource: "categories",
id: record?.category?.id,
queryOptions: {
enabled: !!record,
},
});

return (
<Show isLoading={isLoading}>
<Title order={5}>Id</Title>
<Text mt="sm">{record?.id}</Text>

<Title mt="sm" order={5}>
Category
</Title>
<TextField
value={categoryIsLoading ? "Loading..." : categoryData?.data?.title}
/>
</Show>
);
};

interface ICategory {
id: number;
title: string;
}

interface IPost {
id: number;
category: { id: number };
}

API Reference

Properties

PropertyTypeDescription
value

ReactNode

The value of the field.

External Props:

It also accepts all props of Mantine Text.