content/manuals/extensions/extensions-sdk/design/mui-best-practices.md
This article assumes you're following our recommended practice by using our Material UI theme. Following the steps below maximizes compatibility with Docker Desktop and minimizes the work you need to do as an extension author. They should be considered supplementary to the non-MUI-specific guidelines found in the UI Styling overview.
Resist the temptation to fine-tune your UI with precise colors, offsets and font sizings to make it look as attractive as possible. Any specializations you make today will be relative to the current MUI theme, and may look worse when the theme changes. Any part of the theme might change without warning, including (but not limited to):
red-100) could change their RGB valueserror, primary, textPrimary, etc) could be changed to use a different member of our palettetheme.spacing. For instance, we may allow users to customize the density of the UIThe best way to build your UI, so that it’s robust against future theming changes, is to:
Typographys or Links with appropriate variants instead of using typographical HTML elements (<a>, <p>, <h1>, etc) directly.size="small" on buttons, or fontSize="small" on icons, instead of specifying sizes in pixels.error or primary over explicit color codes.paragraph prop on your Typography instances. If you want to space out something else, use a Stack or Grid with the default spacing.Sometimes you’ll need a piece of UI that doesn’t exist in our design system. If so, we recommend that you first reach out to us. We may already have something in our internal design system, or we may be able to expand our design system to accommodate your use case.
If you still decide to build it yourself after contacting us, try and define the new UI in a reusable fashion. If you define your custom UI in just one place, it’ll make it easier to change in the future if our core theme changes. You could use:
variant of an existing component - see MUI docsSome of the above options require you to extend our MUI theme. See the MUI documentation on theme composition.