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

Decide on initial* vs default* conventions for v11 #9622

Closed
Tracked by #9535
joshblack opened this issue Sep 8, 2021 · 1 comment
Closed
Tracked by #9535

Decide on initial* vs default* conventions for v11 #9622

joshblack opened this issue Sep 8, 2021 · 1 comment

Comments

@joshblack
Copy link
Contributor

joshblack commented Sep 8, 2021

We would like to come up with consistent definitions for when to use initial* and default* prefixed props in our codebase.

Currently, initial is being used 4 times:

default* is being used 6 times:

Background

Historically, defaultValue and value have been used for uncontrolled and controlled components (Link). This convention is useful because a consumer would like to set the value without actually controlling the component. In this case, they would use defaultValue to provide the initial value for the component without controlling it.

Our perspective

We would like to use default* as the standard prefix for setting the initial value of a prop. In particular, this comes up in controlled and uncontrolled components.

Links & Resources

  • Controlled vs uncontrolled
  • Definitions
    • initial --- oxford --- "existing or occurring at the beginning."
    • default --- oxford --- "(of a computer program or other mechanism) revert automatically to (a preselected option)."
    • default --- merriam-webster --- "a selection automatically used by a program in the absence of a choice made by the user"
  • Design Systems / Libraries
    • Radix UI -> uses default for initial value
    • Reach UI -> uses default in a similar way to uncontrolled/controlled
    • Material UI -> uses default for initial value
    • Chakra UI -> uses default for initial value
@joshblack joshblack mentioned this issue Sep 8, 2021
20 tasks
@joshblack joshblack changed the title initial* vs default* Decide on initial* vs default* conventions for v11 Sep 8, 2021
@joshblack
Copy link
Contributor Author

Action items

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

No branches or pull requests

1 participant