@@ -17,6 +17,30 @@ const { meta, getStory } = getStoryFactory({
1717This is a uncontrolled implementation of the modal, compatible with Server Components.
1818An controlled variant is coming soon.
1919
20+ ## The 'createModal' function
21+
22+ The \`createModal(options)\` function take an \`options\` object as parameter.
23+
24+ **Options Params keys:**
25+ - \`name\` (*STRING - Required*): Prefix of the \`Modal\` component name and \`ModalButtonProps\` object name.
26+ - \`isOpenedByDefault\` (*BOOLEAN - Required*): Set the opening state of the Modal after it mount.
27+
28+ **Return:**
29+ An object with two keys. The name of these keys are computed from the value
30+ of \`name\` key of the \`options\` param object :
31+ - \`\${PascalCasePrefix}Modal\`: The Modal component
32+ - \`\${camelCasePrefix}ModalButtonProps\`: The props object for \`Button\` DSFR component
33+
34+ **Eg.:**
35+ \`\`\`
36+ const { MyComponentModal, myComponentButtonProps } = createModal({
37+ name: "myComponent", // The name of Modal component and modalButtonProps is compute from this string
38+ isOpenedByDefault: false
39+ });
40+ \`\`\`
41+
42+ ## The Modal component
43+
2044` ,
2145 "argTypes" : {
2246 "title" : {
@@ -115,10 +139,10 @@ Default.parameters = {
115139import { createModal } from "@codegouvfr/react-dsfr/Modal";
116140import { Button } from "@codegouvfr/react-dsfr/Button";
117141
118- const { AcceptTermsModal, acceptTermsModalButtonProps } = createModal(
119- name: "simple ",
142+ const { AcceptTermsModal, acceptTermsModalButtonProps } = createModal({
143+ name: "acceptTerms ",
120144 isOpenedByDefault: false
121- );
145+ } );
122146
123147function MyComponent(){
124148
0 commit comments