documentation/docs/ui-integrations/chakra-ui/components/fields/text-field/index.md
This field lets you show basic text. It uses Chakra UI's <Text> component.
:::simple Good to know
You can swizzle this component to customize it with the Refine CLI
:::
Let's see how to use it in a basic show page:
setInitialRoutes(["/posts", "/posts/show/123"]);
// visible-block-start
import { useShow } from "@refinedev/core";
import {
Show,
// highlight-next-line
TextField,
} from "@refinedev/chakra-ui";
import { Heading } from "@chakra-ui/react";
const PostShow: React.FC = () => {
const { query } = useShow<IPost>();
const { data, isLoading } = query;
const record = data?.data;
return (
<Show isLoading={isLoading}>
<Heading as="h5" size="sm">
Id
</Heading>
<TextField value={record?.id} />
<Heading as="h5" size="sm">
Title
</Heading>
<TextField value={record?.title} />
</Show>
);
};
interface IPost {
id: number;
title: string;
}
// visible-block-end
render(
<ReactRouter.BrowserRouter>
<RefineChakraDemo
resources={[
{
name: "posts",
show: "/posts/show/:id",
list: "/posts",
},
]}
>
<ReactRouter.Routes>
<ReactRouter.Route
path="/posts"
element={
<div style={{ padding: 16 }}>
<ReactRouter.Outlet />
</div>
}
>
<ReactRouter.Route path="show/:id" element={<PostShow />} />
<ReactRouter.Route
index
element={
<RefineChakra.VStack alignItems="flex-start">
<RefineChakra.Text>This page is empty.</RefineChakra.Text>
<RefineChakra.ShowButton colorScheme="black" recordItemId="123">
Show Item 123
</RefineChakra.ShowButton>
</RefineChakra.VStack>
}
/>
</ReactRouter.Route>
</ReactRouter.Routes>
</RefineChakraDemo>
</ReactRouter.BrowserRouter>,
);
:::simple External Props
It also accepts all props of Chakra UI's Text component.
:::