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

May 2, 2021 18:52 · 102 words · 1 minute read

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>
tweet Share