diff --git a/.changeset/nice-garlics-dance.md b/.changeset/nice-garlics-dance.md
new file mode 100644
index 0000000..1ce19e3
--- /dev/null
+++ b/.changeset/nice-garlics-dance.md
@@ -0,0 +1,5 @@
+---
+"@openfun/cunningham-react": minor
+---
+
+add fullWidth props to Button
diff --git a/packages/react/src/components/Button/index.mdx b/packages/react/src/components/Button/index.mdx
index e0fb15e..ab94249 100644
--- a/packages/react/src/components/Button/index.mdx
+++ b/packages/react/src/components/Button/index.mdx
@@ -52,6 +52,17 @@ The button can be disabled. The disabled button will render the same no matter w
+## Full width
+
+The button can be set to full width. You can use the `fullWidth` prop to do so.
+
+
+
+
+
+
+
+
## Props
You can use all the props of the native html `` element props plus the following.
diff --git a/packages/react/src/components/Button/index.scss b/packages/react/src/components/Button/index.scss
index f9fd4ec..702f69c 100644
--- a/packages/react/src/components/Button/index.scss
+++ b/packages/react/src/components/Button/index.scss
@@ -30,6 +30,11 @@
pointer-events: none;
}
+ &--full-width {
+ width: 100%;
+ justify-content: center;
+ }
+
&--medium {
height: var(--c--components--button--medium-height);
font-size: var(--c--components--button--medium-font-size);
diff --git a/packages/react/src/components/Button/index.stories.tsx b/packages/react/src/components/Button/index.stories.tsx
index 143cd28..f841cda 100644
--- a/packages/react/src/components/Button/index.stories.tsx
+++ b/packages/react/src/components/Button/index.stories.tsx
@@ -54,6 +54,38 @@ export const Small: Story = {
},
};
+export const FullWidth: Story = {
+ args: {
+ children: "Primary",
+ color: "primary",
+ fullWidth: true,
+ },
+};
+
+export const FullWidthWithIcon: Story = {
+ args: {
+ children: "Primary",
+ color: "primary",
+ fullWidth: true,
+ icon: (
+
+
+
+ ),
+ },
+};
+
export const IconLeft: Story = {
args: {
children: "Icon",
diff --git a/packages/react/src/components/Button/index.tsx b/packages/react/src/components/Button/index.tsx
index cfb3b62..ecb6cb5 100644
--- a/packages/react/src/components/Button/index.tsx
+++ b/packages/react/src/components/Button/index.tsx
@@ -6,6 +6,7 @@ interface Props extends ButtonHTMLAttributes {
icon?: ReactNode;
iconPosition?: "left" | "right";
active?: boolean;
+ fullWidth?: boolean;
}
export const Button = forwardRef(
@@ -18,6 +19,7 @@ export const Button = forwardRef(
icon,
active,
className,
+ fullWidth,
...props
},
ref
@@ -37,6 +39,9 @@ export const Button = forwardRef(
if (active) {
classes.push("c__button--active");
}
+ if (fullWidth) {
+ classes.push("c__button--full-width");
+ }
return (
{!!icon && iconPosition === "left" && icon}
diff --git a/packages/react/src/components/Forms/Examples/index.stories.tsx b/packages/react/src/components/Forms/Examples/index.stories.tsx
new file mode 100644
index 0000000..a12d806
--- /dev/null
+++ b/packages/react/src/components/Forms/Examples/index.stories.tsx
@@ -0,0 +1,9 @@
+import { Meta } from "@storybook/react";
+
+export default {
+ title: "Components/Forms/Examples",
+} as Meta;
+
+export const Login = () => {
+ return DOUDOU
;
+};