Skip to content
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

v11 Prop Changes #9535

Closed
14 of 20 tasks
Tracked by #9492 ...
joshblack opened this issue Aug 24, 2021 · 3 comments
Closed
14 of 20 tasks
Tracked by #9492 ...

v11 Prop Changes #9535

joshblack opened this issue Aug 24, 2021 · 3 comments
Labels
planning: umbrella Umbrella issues, surfaced in Projects views

Comments

@joshblack
Copy link
Contributor

joshblack commented Aug 24, 2021

Goal

We want the props for the components in our React library to be consistent and predictable. Props should follow common or familiar conventions and should be consistent across components in the design system.

Links & Resources

Related issues

Checklist

Questions

  • Does the defaultToggled prop make sense? Can you have something be in a "toggled" state or should we indicate that as on/open instead?
@joshblack joshblack changed the title Umbrella [Umbrella] v11 Prop Changes Aug 24, 2021
@joshblack
Copy link
Contributor Author

joshblack commented Aug 24, 2021

Patterns

Deprecating a prop

  • Use the deprecate() helper
The <old-prop-name> prop for <component-name> has been deprecated in favor of <new-prop-name>.
It will be removed in the next major release.
    handleClick: deprecate(
      PropTypes.func,
      'The handleClick prop for ClickableTile has been deprecated in favor of onClick. It will be removed in the next major release.'
    ),

Scenarios

  • You are replacing a prop with a new prop
    • The prop can be added safely in v10
    • The prop can not be added safely in v10 (maybe there is a conflicting prop)
  • You are removing a prop in the next major release
  • You are changing the type of a specific prop
  • You are repurposing a prop, the prop will be used for something else
  • Event handlers (prop signature changes)
    • onChange, onClick, onKeyDown
    • (event) => void, (event, state) => void, (state, event) => void, (state) => void
    • Option 1: (event) => void, (event, state) => void
      • What type should state be?
    • Option 2: we won't ever give you state information in a handler, you must subscribe to onChange, onStateChange

Deprecations

  • Deprecate a prop type (deprecate() helper)
  • Display a deprecation warning (ad-hoc messages)

Feature flags

  • Sometimes we won't need these at all
  • Sometimes we'll need hooks (useFeatureFlag)
  • Sometimes we'll need @carbon/feature-flags

@joshblack

This comment has been minimized.

@joshblack

This comment has been minimized.

@tay1orjones tay1orjones added this to the v11 Beta 3 milestone Nov 2, 2021
@joshblack joshblack removed this from the v11 Beta 3 milestone Dec 6, 2021
@tay1orjones tay1orjones added planning: umbrella Umbrella issues, surfaced in Projects views and removed Epic labels Dec 10, 2021
@tay1orjones tay1orjones changed the title [Umbrella] v11 Prop Changes v11 Prop Changes Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planning: umbrella Umbrella issues, surfaced in Projects views
Projects
Archived in project
Development

No branches or pull requests

2 participants