---
layout: default
title: "The SingleFieldList Component"
storybook_path: ra-ui-materialui-list-singlefieldlist--basic
---
# ``
Use `` when you want to display only one property for each record in a list, for instance, to display the list of tag names for a post.

`` is an **iterator** component: it gets `data` from the `ListContext`, and iterates over it to display each record. It creates a `` for each record, and delegates the actual rendering to its child - usually a Field component.
## Usage
`` grabs the current `ListContext`, and renders a Material UI `` with one `` for each record in the list, using the `recordRepresentation`. It is especially useful as child of `` and `` components.
Here is an example of a Post show page showing the list of tags for the current post:
```jsx
import {
Show,
SimpleShowLayout,
TextField,
ReferenceArrayField,
SingleFieldList
} from 'react-admin';
const PostShow = () => (
);
```
You can also use `` in a list view, e.g. to display the tags for each post in a ``:
```jsx
import {
List,
DataTable,
ReferenceArrayField,
SingleFieldList,
DateField,
BooleanField,
ChipField
} from 'react-admin';
const PostList = () => (
)
```

You can customize how each record is displayed by passing a Field component as child. For example, you can change the field name used by the ``:
```jsx
```
## Props
`` accepts the following props:
| Prop | Required | Type | Default | Description |
| ----------- | -------- | ------------------------- | ------- | ----------------------------------------------- |
| `children` | Optional | `ReactNode` | | React element to render for each record |
| `empty` | Optional | `ReactNode` | | React element to display when the list is empty |
| `linkType` | Optional | `'edit' | 'show' | false` | `edit` | The target of the link on each item |
| `sx` | Optional | `object` | | The sx props of the Material UI Box component |
Additional props are passed down to the underlying [Material UI `` component](https://mui.com/material-ui/react-stack/).
## `children`
By default, `` renders a `` for each record. You can customize the rendering by passing a Field component as child.
For example, if you want to customize the field name used by the ``:
```jsx
```
## `empty`
When the list is empty, `` displays nothing. You can customize this behavior by passing a React element as the `empty` prop. For example, to display a message:
```jsx
Nothing to display
} />
```
## `linkType`
The `` items link to the edition page by default. You can set the `linkType` prop to `show` to link to the `` page instead.
```jsx
// Display all the tags for the current post
```
`linkType` accepts the following values:
* `linkType="edit"`: links to the edit page. This is the default behavior.
* `linkType="show"`: links to the show page.
* `linkType={false}`: does not create any link.
## `sx`: CSS API
The `` component accepts the usual `className` prop. You can also override the styles of the inner components thanks to the `sx` property. This property accepts the following subclasses:
| Rule name | Description |
|-----------------------------|-------------------------|
| `& .RaSingleFieldList-link` | Applied to each link |
**Tip**: You can override these classes for all `` instances by overriding them in a Material UI theme, using the key "RaSingleFieldList".
## Rendering An Array Of Strings
If you need to render a custom collection (e.g. an array of tags `['dolor', 'sit', 'amet']`), you may want to use the [``](./TextArrayField.md) component instead.
```jsx
```