Socket
Socket
Sign inDemoInstall

@mantine/styles

Package Overview
Dependencies
Maintainers
1
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mantine/styles

Mantine css-in-js styles engine, based on emotion


Version published
Weekly downloads
205K
decreased by-3.31%
Maintainers
1
Weekly downloads
 
Created

What is @mantine/styles?

@mantine/styles is a utility package for styling React components. It provides a set of tools to create and manage styles in a consistent and scalable way. The package includes features like theming, CSS-in-JS, and utility functions for handling styles.

What are @mantine/styles's main functionalities?

Theming

Theming allows you to define a consistent look and feel across your application. You can set global styles, color schemes, and other design tokens.

import { MantineProvider } from '@mantine/core';

function App() {
  return (
    <MantineProvider theme={{ colorScheme: 'dark' }}>
      <YourComponent />
    </MantineProvider>
  );
}

CSS-in-JS

CSS-in-JS allows you to write CSS directly within your JavaScript code. This approach helps in scoping styles to components and leveraging JavaScript's capabilities for dynamic styling.

import { createStyles } from '@mantine/core';

const useStyles = createStyles((theme) => ({
  button: {
    backgroundColor: theme.colors.blue[6],
    color: theme.white,
    '&:hover': {
      backgroundColor: theme.colors.blue[7],
    },
  },
}));

function YourComponent() {
  const { classes } = useStyles();
  return <button className={classes.button}>Click me</button>;
}

Utility Functions

Utility functions provide additional capabilities for managing styles. For example, `getStylesRef` can be used to create references to styles that can be reused across different components.

import { getStylesRef } from '@mantine/core';

const ref = getStylesRef('my-element');

const useStyles = createStyles((theme) => ({
  [ref]: {
    color: theme.colors.red[6],
  },
}));

function YourComponent() {
  const { classes } = useStyles();
  return <div className={classes[ref]}>Styled element</div>;
}

Other packages similar to @mantine/styles

Keywords

FAQs

Package last updated on 04 Jul 2023

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