(TextArea) add classic variant and hideLabel props

- Add variant prop with classic mode support
- Add hideLabel prop for accessible hidden labels
- Label rendered outside wrapper in classic mode
- Native placeholder support in classic mode
- Compact height in classic mode
- Add unit tests and Storybook stories

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nathan Panchout
2026-01-26 20:07:46 +01:00
parent c2a0013cc8
commit fb0c8c0f10
4 changed files with 242 additions and 35 deletions

View File

@@ -10,6 +10,12 @@ export default {
args: {
rows: 4,
},
argTypes: {
variant: {
control: "select",
options: ["floating", "classic"],
},
},
} as Meta<typeof TextArea>;
export const ShowCase = () => {
@@ -175,6 +181,60 @@ export const WithRef = () => {
);
};
export const ClassicVariant = {
args: {
label: "Description",
variant: "classic",
placeholder: "Enter a description...",
},
};
export const ClassicVariantFilled = {
args: {
label: "Description",
variant: "classic",
placeholder: "Enter a description...",
defaultValue: "This is a detailed description of the project.",
},
};
export const ClassicVariantDisabled = {
args: {
label: "Description",
variant: "classic",
placeholder: "Enter a description...",
disabled: true,
},
};
export const ClassicVariantError = {
args: {
label: "Description",
variant: "classic",
placeholder: "Enter a description...",
defaultValue: "Too short",
state: "error",
text: "Description must be at least 50 characters",
},
};
export const HiddenLabel = {
args: {
label: "Notes",
hideLabel: true,
placeholder: "Add your notes here...",
},
};
export const HiddenLabelClassic = {
args: {
label: "Notes",
variant: "classic",
hideLabel: true,
placeholder: "Add your notes here...",
},
};
export const FormExample = () => {
return (
<div>