LogoLogo
GitHub repository
GitHub repository
    Documentation
  • Overview
  • Getting Started
  • Guides


    • Styling, CSS-in-JS, and Joy UI
    • Using MDX
    • Advanced Concepts
  • Hooks

  • Components

Styling, CSS-in-JS, and Joy UI

This template makes heavy use of Joy UI components. It was built on the same components as MUI's Material UI, but with more barebones styling that is easier to customize and doesn't look as much like Google.
Joy UI's Link component is set up in a way that it always uses Next.js' Link component under the hood, providing you with advanced routing and prefetching capabilities.

Styling & theming

Modify the file in src/theme.tsx to customize Joy UI components. You can edit color themes, default props, and CSS variables.
In general, when customizing a component, use the following order of preference:
  • Props like color, variant, size, etc. You can add custom color palettes and variants in src/theme.tsx.
  • CSS variables like --Button-radius or --Button-gap.
  • Inline styles using the sx prop. These give you full flexibility on the component's CSS style. Joy UI uses Emotion to compile these into a compact stylesheet, so you don't have to worry about performance. However, doing this on a per-component basis can lead to inconsistencies, and compatibility problems with other components.

Why no Tailwind?

Template enhancements

If you've previously used Joy UI, this template also includes a few components that are built on-top of Joy UI components and should, in most cases, be used instead of the original Joy UI component. These are:
  • SmartLink over Link for smart external link detection, adding an indicator and opening a new tab automatically
  • Paragraph over Typography for a paragraph component that includes margin defaults and links for titles. Typography is still useful in many cases where you don't want those defaults
  • AsyncButton over Button for a button that can be passed an async function in its onClick prop and will automatically show a loading indicator
  • AsyncIconButton over IconButton for the same reason as AsyncButton

LogoLogo