Skip to content

Commit

Permalink
Merge pull request #1 from revolunet/patch-1
Browse files Browse the repository at this point in the history
docs: Update README.md
  • Loading branch information
EmileRolley authored Jun 28, 2024
2 parents e3eaee7 + e1d14db commit 62a06dd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,28 @@ yarn add @codegouvfr/rjsf-dsfr

For now, the API matches the one from `react-jsonschema-form` and you can
overrides some widgets (resp. templates) by specifying them in the props.

```tsx
import { RJSFSchema } from "@rjsf/utils";
import FormDSFR from "@codegouvfr/rjsf-dsfr";
import { customizeValidator } from "@rjsf/validator-ajv8";
import frenchLocalizer from "ajv-i18n/localize/fr";

const validator = customizeValidator({}, frenchLocalizer);

const schema: RJSFSchema = {
type: "object",
properties: {
nom: { title: "Nom", type: "string", minLength: 2 },
prenom: { title: "Prénom", type: "string" },
ddn: { title: "Date de naissance", type: "string", format: "date" },
},
required: ["nom"],
};

export default function Form() {
return (
<FormDSFR schema={schema} validator={validator} />
);
}
```

0 comments on commit 62a06dd

Please sign in to comment.