Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mui/styles

Package Overview
Dependencies
Maintainers
6
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mui/styles

MUI Styles - The legacy JSS-based styling solution of Material UI.

  • 5.10.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
486K
decreased by-28.94%
Maintainers
6
Weekly downloads
 
Created

What is @mui/styles?

@mui/styles is a styling solution for React applications that is part of the Material-UI library. It provides a set of utilities to help you style your components using JavaScript, allowing for dynamic and theme-based styling.

What are @mui/styles's main functionalities?

CSS-in-JS

This feature allows you to define styles using JavaScript objects. The `makeStyles` function generates a hook that you can use to apply these styles to your components.

const useStyles = makeStyles({
  root: {
    background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
    border: 0,
    borderRadius: 3,
    boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
    color: 'white',
    height: 48,
    padding: '0 30px',
  },
});

function MyComponent() {
  const classes = useStyles();
  return <button className={classes.root}>Styled Button</button>;
}

Theming

Theming allows you to define a theme object that can be used to provide consistent styling across your application. The `ThemeProvider` component makes the theme available to all components within its subtree.

const theme = createTheme({
  palette: {
    primary: {
      main: '#1976d2',
    },
    secondary: {
      main: '#dc004e',
    },
  },
});

function ThemedComponent() {
  return (
    <ThemeProvider theme={theme}>
      <Button color="primary">Primary Button</Button>
      <Button color="secondary">Secondary Button</Button>
    </ThemeProvider>
  );
}

Styled Components

Styled Components allow you to create custom-styled components using the `styled` function. This approach provides a more component-centric way of applying styles.

const MyButton = styled('button')({
  background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
  border: 0,
  borderRadius: 3,
  boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
  color: 'white',
  height: 48,
  padding: '0 30px',
});

function MyComponent() {
  return <MyButton>Styled Button</MyButton>;
}

Other packages similar to @mui/styles

Keywords

FAQs

Package last updated on 29 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc