Skip to content

Remove uncontrolled input support #7458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

damienrobson-sage
Copy link
Contributor

@damienrobson-sage damienrobson-sage commented Jul 23, 2025

BREAKING CHANGE: all input-based components must now be used in a controlled manner e.g.:

import React, { useState } from 'react';
import Textbox from 'carbon-react/lib/components/textbox;

const CustomTextbox = (args) => {
  const [value, setValue] = useState("");
  return <Textbox value={value} onChange={e => setValue(e.target.value)} />;
}

Component props designed to support uncontrolled usage e.g. defaultValue have been removed, and all value and onChange props are now required

Proposed behaviour

Remove support for uncontrolled usage from the following components:

  • Textbox
  • Decimal
  • Number
  • SimpleSelect
  • Filterable Select
  • MultiSelect
  • GroupedCharacter
  • NumeralDate
  • Search
  • Checkbox
  • RadioButton
  • Switch
  • SimpleColorPicker
  • AdvancedColorPicker
  • ButtonToggle
  • Password
  • TextArea

Current behaviour

Our input-based components support uncontrolled usage

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

@damienrobson-sage damienrobson-sage self-assigned this Jul 23, 2025
@damienrobson-sage damienrobson-sage added the Work in progress This is a WIP PR so may not be ready for review label Jul 23, 2025
@damienrobson-sage damienrobson-sage force-pushed the FE-5305-remove-uncontrolled-input-support branch 2 times, most recently from 5c55695 to 3b4313b Compare July 29, 2025 12:20
@damienrobson-sage damienrobson-sage force-pushed the FE-5305-remove-uncontrolled-input-support branch from c53511b to d7a32d8 Compare August 1, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Work in progress This is a WIP PR so may not be ready for review
Development

Successfully merging this pull request may close these issues.

1 participant