created: 2021-05-02T09:52:59.000Z

React-admin の登録/更新画面でreadonlyなフィールドをつくる

Listコンポーネントで使う TextField などのコンポーネントを使えばよい。

A Field component displays a given property of a REST resource. Such components are used in the List and Show views, but you can also use them in the Edit and Create views for read-only fields.

  <Edit {...props}>
    <SimpleForm>
      // userId は readonly
      <TextField source="userId" />
      // expireAt は日付データのinput
      <DateInput source="expireAt" />
    </SimpleForm>
  </Edit>
アレ何? 大事典
[ad] アレ何? 大事典
佐々木 正孝, 篠崎 晃一 (単行本)