Skip to content

Comments

Feat: component textarea#209

Open
swayamk05 wants to merge 1 commit intortCamp:developfrom
swayamk05:feat/component-textarea
Open

Feat: component textarea#209
swayamk05 wants to merge 1 commit intortCamp:developfrom
swayamk05:feat/component-textarea

Conversation

@swayamk05
Copy link

Summary

Adds a new Textarea component to the Frappe UI React library, providing a multi-line text input with multiple variants, validation states, and debounce functionality.

Features

  • Four variants: subtle, outline, ghost, underline
  • Validation states: success, warning, error for form feedback
  • Loading state: Disables interaction when loading
  • Debounce support: Configurable delay for onChange events
  • Configurable rows: Control visible textarea height
  • forwardRef support: Full ref forwarding for external control

Implementation Details

  • Object lookup pattern for variant/state styling (no switch statements)
  • Semantic design tokens (ink-*, surface-*, outline-*) for theming consistency
  • Extends native TextareaHTMLAttributes with proper type omissions
  • Uses clsx for conditional class composition
  • Auto-generated IDs with useId hook when htmlId not provided
  • TypeScript types exported from dedicated types.ts file

Files Added/Modified

  • textarea.tsx — Main component implementation with forwardRef
  • types.ts — TypeScript type definitions
  • textarea.stories.tsx — Storybook stories with autodocs
  • index.ts — Exports
  • tests/textarea.tsx — Unit tests

Storybook

  • Includes separate stories for each variant (Subtle, Outline, Ghost, Underline)
  • All props have descriptions in argTypes
  • Interactive controls for size, variant, state, disabled, loading, rows, debounce

Testing

  • ✅ Calls onChange when typing
  • ✅ Disabled state works correctly

Checklist

  • Code follows project coding style
  • Linting passes for component source files
  • TypeScript types are correct
  • Unit tests added and passing
  • Storybook documentation added with autodocs
  • No hardcoded colors — uses design tokens
  • Uses object lookup pattern for variants
  • Exports added to index.ts

fixes #91

textarea.component.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant