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

Add custom component example #3329

Merged
merged 4 commits into from
Mar 27, 2024
Merged

Add custom component example #3329

merged 4 commits into from
Mar 27, 2024

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Mar 26, 2024

Add example that demonstrates creating a custom component

@Janpot Janpot added the examples Relating to /examples label Mar 26, 2024
@Janpot Janpot marked this pull request as ready for review March 26, 2024 14:57
@Janpot Janpot requested a review from a team March 26, 2024 14:57
Copy link
Member

@apedroferreira apedroferreira left a comment

Choose a reason for hiding this comment

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

Looks good, just left some minor comments!
Also not sure if we should exemplify more arg types, for example, but I think this is good enough as a basic example.

}

function Clock({ msg }: ClockProps) {
const [time, setTime] = React.useState(() => new Date().toLocaleTimeString());
Copy link
Member

Choose a reason for hiding this comment

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

Maybe some whitespace between the state, effect and render makes it more readable?


export default createComponent(Clock, {
argTypes: {
msg: {
Copy link
Member

Choose a reason for hiding this comment

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

Would label be a more descriptive name for this prop?

@Janpot Janpot merged commit 6effc30 into mui:master Mar 27, 2024
12 checks passed
@Janpot Janpot deleted the custom-component-ex branch March 27, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Relating to /examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants