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

[Joy][docs] Add documentation for Input component #35482

Merged
merged 22 commits into from Dec 28, 2022

Conversation

hbjORbj
Copy link
Member

@hbjORbj hbjORbj commented Dec 14, 2022

As we are progressing towards removing TextField from Joy UI (#35462) (#34176), documentation for Input component has become essential.

Preview: https://deploy-preview-35482--material-ui.netlify.app/joy-ui/react-input

@hbjORbj hbjORbj self-assigned this Dec 14, 2022
@hbjORbj hbjORbj added docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy labels Dec 14, 2022
@mui-bot
Copy link

mui-bot commented Dec 14, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-35482--material-ui.netlify.app/

No bundle size changes

Generated by 🚫 dangerJS against 9230e2e

@hbjORbj
Copy link
Member Author

hbjORbj commented Dec 21, 2022

@siriwatknp I restructured the docs, polished and added a common example "newsletter subscription", inspired by https://dribbble.com/shots/14442751-Newsletter-Subscribe-Animation; Let me know!

@siriwatknp
Copy link
Member

@siriwatknp I restructured the docs, polished and added a common example "newsletter subscription", inspired by https://dribbble.com/shots/14442751-Newsletter-Subscribe-Animation; Let me know!

Thanks, @hbjORbj. After seeing the subscription demo, I think the input deserves to have a CSS variables playground to help developers create their own version of Input.

Here is the list of variables that should be in the playground.

  • --Input-radius
  • --Input-gap
  • --Input-placeholderOpacity
  • --Input-focusedThickness
  • --Input-minHeight
  • --Input-paddingInline
  • --Input-decorator-childHeight

The input preview should have:

  • placeholder
  • an icon as the start decorator
  • a button (or icon button) as the end decorator

@hbjORbj
Copy link
Member Author

hbjORbj commented Dec 22, 2022

Hey, Jun, I added CSS variable playground. Opacity can't be in px, so I made some changes to JoyVariablesDemo.tsx. e.g.,

index 8ef657dc55..861acb8320 100644
--- a/docs/src/modules/components/JoyVariablesDemo.tsx
+++ b/docs/src/modules/components/JoyVariablesDemo.tsx
@@ -15,11 +15,11 @@ import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
 
 interface DataItem {
   var: string;
-  defaultValue?: string;
+  defaultValue?: string | number;
   helperText?: string;
 }

Screenshot 2022-12-22 at 09 52 41

I wanted to make the stepper to increment/decrement by 0.1 but I couldn't find where that stepper is coming from. I found that it disappears when I remove type='number' from TextField, but couldn't locate the logic in the behind-the-scenes. Can you help?

@siriwatknp
Copy link
Member

Hey, Jun, I added CSS variable playground. Opacity can't be in px, so I made some changes to JoyVariablesDemo.tsx. e.g.,

index 8ef657dc55..861acb8320 100644
--- a/docs/src/modules/components/JoyVariablesDemo.tsx
+++ b/docs/src/modules/components/JoyVariablesDemo.tsx
@@ -15,11 +15,11 @@ import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
 
 interface DataItem {
   var: string;
-  defaultValue?: string;
+  defaultValue?: string | number;
   helperText?: string;
 }
Screenshot 2022-12-22 at 09 52 41

I wanted to make the stepper to increment/decrement by 0.1 but I couldn't find where that stepper is coming from. I found that it disappears when I remove type='number' from TextField, but couldn't locate the logic in the behind-the-scenes. Can you help?

It is the native HTML input attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#step.

@hbjORbj
Copy link
Member Author

hbjORbj commented Dec 26, 2022

Made some improvements to JoyVariablesDemo.tsx. DataItem now has an extra prop inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
e.g.,

        {
          var: '--Input-placeholderOpacity',
          defaultValue: 0.5,
          inputAttributes: {
            min: 0.1,
            max: 1,
            step: 0.1,
          },
        },

Inner HTML input demo is ready as well.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great job! pushed some updates

@hbjORbj hbjORbj merged commit a412eac into mui:master Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants