-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[base][docs] Base UI Quickstart Guide #36717
Conversation
33e6381
to
84fba4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mj12albert For the light & dark, I suggest using CSS variables instead of having 2 files with javascript theme.
It could look something like this:
const getStyles = () => ({
--btn-background: #1f883d,
'.mode-dark': { // class name `mode-dark` is handled by the docs
--btn-background: #238636,
},
background-color: 'var(--btn-background)',
})
const GithubButtonComponent = styled(ButtonUnstyled)(getStyles);
Demo: https://deploy-preview-36717--material-ui.netlify.app/base/getting-started/quickstart/ I'm still polishing the demos and snippets, but the content itself is ready for an early review - please have a look and welcome feedback on anything that catches your eye! @michaldudak @mnajdova @samuelsycamore |
Let me try this – I wanted to separate them completely at first because I didn't want the snippets to show anything related to color mode at this point. But since I'm mostly not using the generated one anyway it probably doesn't matter in the end. |
This is looking excellent, Albert ⎯ excited to see it shaping up! To start off, one high-level thing I thought it'd be better is separating the Tutorial from the Installation page, having it be a standalone page as it is with Joy. What do you think? |
🤔 Perhaps I should not use |
84fba4a
to
d947426
Compare
This is looking great @mj12albert !! Before I do a line-by-line edit, here are some big-picture notes:
|
0168b0e
to
294da4e
Compare
@danilo-leal @samuelsycamore I changed the heading to not use the word "tutorial" and updated the PR description to be clearer 😅 This is meant to be an expansion of the current quickstart section, and not a step-by-step tutorial like the Joy UI tutorial. So it totally makes sense to remain on the "Usage" page. But I wonder if Base really needs a separate installation page (just because the other packages have one). It's only one package and the page will become even shorter after #36766 PS I have done the style guide edits |
Yeah, it definitely makes me think that, given the new installation code block, the "Installation" + "Usage" page across all docs could be unified. I'd be down for this approach! It's important we keep consistency, though, regardless of which we end up picking! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review is mostly just applying the style guide—the content is looking great!
f4ee49c
to
fea4f9c
Compare
@mui/core bumping this for a re-review, I think it should be good to go ~ 😬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall! Awesome job 🤙
Left just a tiny comment there.
## Implementing a Button | ||
|
||
This is a quick tutorial that goes through the basics of using and styling Base UI components by replicating a button from GitHub's UI, using their [Primer design system](https://primer.style) as a reference. | ||
Base UI components help you abstract away low-level UI implementation details such as accessibility patterns, cross-browser compatibility, event handling, and more, while remaining unopinionated about styling, giving you complete control over your app's CSS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base UI components help you abstract away low-level UI implementation details such as accessibility patterns, cross-browser compatibility, event handling, and more, while remaining unopinionated about styling, giving you complete control over your app's CSS. | |
### Advantages of using Base UI | |
Base UI components help you abstract away low-level UI implementation details such as accessibility patterns, cross-browser compatibility, event handling, and more, while remaining unopinionated about styling, giving you complete control over your app's CSS. |
Was a bit hesitant to suggest this on this page, feeling like it could be out of place, but I think a title here to make this paragraph stand out a bit more would be helpful. Not married to it but what do y'all think? @mj12albert + @samuelsycamore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bad idea. I think I'd go with something like "Why Base UI?" or "Why use a Base UI Button?" But you could also cut the section entirely and the piece would be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be down for placing this paragraph somewhere else, folks might be convinced of using Base UI already if they're diving into the Quickstart doc. But if we were to keep it, also down for your title suggestions there 🤙
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me take it out for now, and we can add it separately to the Overview page as Sam previously suggested !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good! Just one small remark from me.
|
||
### Components and hooks | ||
|
||
Base UI provides a Button component and a `useButton` hook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base UI provides a Button component and a `useButton` hook. | |
Base UI provides a Button component and a useButton hook. |
or "a Button
component and a useButton
hook"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaldudak according to the Style Guide, the way it's written currently is correct. (Of course it can always be changed as we see fit.)
If you wanted to put both in backticks, the preferred style would be <Button />
and useButton
. If you think that neither of them should have backticks, then there are many other instances of useSomeHook
throughout the Base and Joy docs that we'll want to update to remove backticks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with <Button />
here as it's the first occurrence of the button component, subsequent ones will have no backtick
fea4f9c
to
7c5f0a9
Compare
Closes #32979
This PR addresses all 3 points from #32979 by expanding the "Quickstart" to demo how to style a button with a few styling solutions (plain CSS, Tailwind, MUI system) using mostly snippets (not complete code), though complete demos are still provided for each.
Additionally, I made a separate Quickstart page that includes the installation instructions too. Base is one package and the installation instructions will become even shorter after this, it seems a bit much to have a page just for that (despite the fact that our other docs have an Installation page, but they are all more complex).