Skip to content

Commit

Permalink
Remove doc from BooleanField
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed May 3, 2023
1 parent 1f4a429 commit 61a7dd6
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions docs/BooleanField.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,3 @@ import AlarmOnIcon from '@mui/icons-material/AlarmOn';

<BooleanField source="alarm" TrueIcon={AlarmOnIcon} FalseIcon={null} />
```

## TypeScript

The `<BooleanField>` component accept a generic type that describe the record. This is used to validate the `source` prop to ensure it targets an actual property of the record:

```tsx
import * as React from "react";
import { Show, SimpleShowLayout, TextField, BooleanField, RichTextField } from 'react-admin';

type Post = {
id: number;
title: string;
teaser: string;
body: string;
published: boolean;
}

export const PostShow = () => (
<Show>
<SimpleShowLayout>
<TextField<Post> source="title" />
<TextField<Post> source="teaser" />
<RichTextField<Post> source="body" />
<BooleanField<Post> source="published" />
</SimpleShowLayout>
</Show>
);
```

Specifying the record type will also allow your IDE to provide auto-completion for both the `source` and `sortBy` prop. Note that the `sortBy` prop also accept any string.

0 comments on commit 61a7dd6

Please sign in to comment.