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

[blog] Introducing MUI Base #33778

Merged
merged 29 commits into from Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dba2e55
Document outline
michaldudak Aug 2, 2022
f908780
First draft
michaldudak Aug 3, 2022
d7a4442
Prettier
michaldudak Aug 3, 2022
70e2552
Enhance the introduction
michaldudak Aug 17, 2022
70a4287
Punctuation
michaldudak Aug 17, 2022
c7b481d
Add an image and code sample
michaldudak Aug 17, 2022
4cacd4e
Link to Base docs
michaldudak Aug 17, 2022
3912381
Prettier
michaldudak Aug 17, 2022
fc89d62
Make the image prettier
michaldudak Aug 17, 2022
e91896e
Update docs/pages/blog/introducing-mui-base.md
michaldudak Aug 25, 2022
7c72379
Apply suggestions from code review
michaldudak Aug 25, 2022
44e4fcd
More corrections
michaldudak Aug 25, 2022
d679379
Merge remote-tracking branch 'upstream/master' into blog/introducing-…
michaldudak Aug 25, 2022
4d9561d
add blog images and social card
danilo-leal Aug 26, 2022
2d384a5
Update the title
michaldudak Aug 26, 2022
45f0d76
Fix JSX
oliviertassinari Aug 28, 2022
a4a28ab
Apply suggestions from code review
michaldudak Aug 31, 2022
d674d92
Merge branch 'master' into blog/introducing-base
michaldudak Aug 31, 2022
7905d8f
Add the Why MUI Base section
michaldudak Aug 31, 2022
4991788
Apply suggestions from code review
michaldudak Sep 1, 2022
eb8bab8
Update docs/pages/blog/introducing-mui-base.md
michaldudak Sep 5, 2022
e70218f
Merge remote-tracking branch 'upstream/master' into blog/introducing-…
michaldudak Sep 5, 2022
c8f05ca
Update the publish date
michaldudak Sep 5, 2022
c163b9f
Add live demo and explain advantages of using Base
michaldudak Sep 5, 2022
9c1cb08
Update docs/pages/blog/introducing-mui-base.md
michaldudak Sep 6, 2022
6243a03
Add docs link
michaldudak Sep 6, 2022
feb9724
Update the publish date
michaldudak Sep 7, 2022
5299fe1
Merge remote-tracking branch 'upstream/master' into blog/introducing-…
michaldudak Sep 7, 2022
b88ea82
Merge remote-tracking branch 'upstream/master' into blog/introducing-…
michaldudak Sep 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/pages/blog/introducing-mui-base.js
@@ -0,0 +1,7 @@
import * as React from 'react';
import TopLayoutBlog from 'docs/src/modules/components/TopLayoutBlog';
import { docs } from './introducing-mui-base.md?@mui/markdown';

export default function Page() {
return <TopLayoutBlog docs={docs} />;
}
93 changes: 93 additions & 0 deletions docs/pages/blog/introducing-mui-base.md
@@ -0,0 +1,93 @@
---
title: Introducing MUI Base
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
description: 'Introduction to a new library of unstyled components and hooks: MUI Base'
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
date: 2022-08-29T00:00:00.000Z
authors: ['michaldudak']
tags: ['News', 'MUI Core']
card: true
---

<!-- hero image goes here -->

Throughout the years, Material UI has been used to build various types of applications.
Its speed of use helped create admin user interfaces, while its customizability made it a foundation of custom design systems.
Creating design systems that substantially diverge from Google's Material Design may, however, not be an easy task.
Developers do not start from a clean slate but have to override styles applied by the library's components.
While this approach may speed up the work when designing visuals close to Material Design, it's less intuitive for different design languages.

We were aware of this problem, so, [encouraged by the community](https://github.com/mui/material-ui/issues/6218), we decided to build a library aiming for the ultimate customizability.
Today, we're ready to announce it: **please welcome MUI Base**, the library of unstyled React UI components and hooks!

Its API is similar to what you're already used to in Material UI.
This makes it easy to either start a new project with MUI Base or to use Material UI for rapid prototyping first and then switch to MUI Base when a custom design is needed.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

## Components and hooks

MUI Base offers two kinds of building blocks: unstyled components and hooks.

Components are more straightforward to use of the two.
Place a component on a page, add your own styles, and it's ready to go!
It's important to note that you are not limited to the styling options available in Material UI.
You can, of course, still use our MUI System, but if you prefer Emotion, Tailwind, plain CSS, or any other styling engine, they are available too!
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
Check out the [Working with Tailwind CSS guide](/base/guides/working-with-tailwind-css/) for an example of using this library.

In contrast to Material UI, Base's components do not have any default styles.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
They provide functionality and structure, while designers and developers are responsible for the visuals.

Each unstyled component lets developers modify or override its _slots_, smaller subcomponents representing parts that work together.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
For example, a SwitchUnstyled contains the root, thumb, input, and track slots.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
You can control props passed to each of these slots (including, perhaps most importantly, `className`) based on the component's state or even replace the default slot components with your own.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

<img src="/static/blog/introducing-mui-base/switch-slots.png" style="width: 796px; margin-bottom: 24px;" alt="Depiction of SwitchUnstyled components' slots" />
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

Hooks take this one step further.
They provide functionality, and developers are free to implement the structure to the DOM elements, their interactions, and look.
They offer maximum customizability at the cost of requiring more to implement by developers.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

Upon calling, a hook returns an object describing the component's state (i.e., whether the switch is turned on) and with methods that apply accessibility props and event handlers.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
You should spread these props on components you defined.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

```tsx
function MySwitch(props: UseSwitchParameters) {
const { getInputProps, checked, disabled } = useSwitch(props);

const stateClasses = {
checked,
disabled,
};

return (
<span className={clsx('root', stateClasses)}>
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
<span className="thumb"} />
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
<input type="hidden" {...getInputProps()} />
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
</span>
);
}
```

## What's included

We are releasing the initial version of the library with 17 components.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
Their docs are available on [our website](/base/getting-started/overview/).
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

We are going to work on creating more in the upcoming months.
You can track our progress (and comment to influence our priorities) on a [dedicated GitHub issue](https://github.com/mui/material-ui/issues/27170).
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

The @mui/base package is released as an alpha.
This means the API of the components can still change, especially when we receive feedback about its current state from the community.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
However, we believe the library is solid enough to build design systems with it.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
In fact, we're using MUI Base to create [Joy UI](/blog/first-look-at-joy/).
michaldudak marked this conversation as resolved.
Show resolved Hide resolved
In the future, MUI Base will also be used as a foundation of Material UI components so that you can expect consistent quality across our entire suite of products.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

## Feedback needed

So far, we've been mostly using MUI Base ourselves.
Now we need to hear what you think of the library, what you like about it, and what are the areas that could look or work differently.
Please help us create the best possible headless component library out there!

If you found any bugs, have trouble understanding some concepts, or have ideas for improvements, don't hesitate to open issues on GitHub.
Make sure to include "[base]" or a component/hook name in the issue title, so we recognize it.
Also, we're eager to know what you create with MUI Base.
Please share your creations on Twitter to let us (and others) know what our library can be used for.
michaldudak marked this conversation as resolved.
Show resolved Hide resolved

**Happy creating!**
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.