Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@fluentui/style-utilities
Advanced tools
@fluentui/style-utilities is a utility library for styling in the Fluent UI ecosystem. It provides a set of functions and utilities to help with theming, styling, and responsive design in React applications.
Theming
Theming allows you to create a consistent look and feel across your application by defining a set of colors and styles. The `createTheme` function helps you generate a theme object that can be used throughout your application.
const { createTheme } = require('@fluentui/style-utilities');
const myTheme = createTheme({
palette: {
themePrimary: '#0078d4',
themeLighterAlt: '#eff6fc',
themeLighter: '#deecf9',
themeLight: '#c7e0f4',
themeTertiary: '#71afe5',
themeSecondary: '#2b88d8',
themeDarkAlt: '#106ebe',
themeDark: '#005a9e',
themeDarker: '#004578',
neutralLighterAlt: '#f8f8f8',
neutralLighter: '#f4f4f4',
neutralLight: '#eaeaea',
neutralQuaternaryAlt: '#dadada',
neutralQuaternary: '#d0d0d0',
neutralTertiaryAlt: '#c8c8c8',
neutralTertiary: '#c2c2c2',
neutralSecondary: '#858585',
neutralPrimaryAlt: '#4b4b4b',
neutralPrimary: '#333333',
neutralDark: '#272727',
black: '#1d1d1d',
white: '#ffffff'
}
});
Responsive Design
Responsive design utilities help you create styles that adapt to different screen sizes. The `getScreenSelector` function returns a media query string for a given breakpoint, which can be used to apply styles conditionally.
const { getScreenSelector } = require('@fluentui/style-utilities');
const screenSelector = getScreenSelector('medium');
const styles = {
root: {
[screenSelector]: {
backgroundColor: 'blue'
}
}
};
Style Merging
Style merging allows you to combine multiple style objects into a single class name. The `mergeStyles` function takes one or more style objects and returns a class name that can be applied to a component.
const { mergeStyles } = require('@fluentui/style-utilities');
const classNames = mergeStyles({
backgroundColor: 'red',
selectors: {
':hover': {
backgroundColor: 'blue'
}
}
});
Emotion is a library designed for writing CSS styles with JavaScript. It provides powerful and flexible styling capabilities, including theming, style composition, and dynamic styling. Compared to @fluentui/style-utilities, Emotion offers a more modern and flexible API for styling React components.
Styled-components is a popular library for styling React applications using tagged template literals. It allows you to write actual CSS code to style your components and supports theming and dynamic styling. Styled-components is similar to @fluentui/style-utilities in that it provides utilities for theming and responsive design, but it uses a different approach with tagged template literals.
Aphrodite is a library for writing CSS styles in JavaScript. It provides a simple API for defining and applying styles, with support for media queries and pseudo-selectors. Aphrodite is similar to @fluentui/style-utilities in its focus on writing styles in JavaScript, but it offers a more minimalistic and straightforward API.
Styling helpers for Fluent UI React (formerly Office UI Fabric React)
Integrating components into your project depends heavily on your setup. The recommended setup is to use a bundler such as webpack which can resolve NPM package imports in your code and can bundle the specific things you import.
If you're using @fluentui/react
, the @fluentui/style-utilities
package contents are re-exported under @fluentui/react/lib/Styling
. It's recommended to access the package this way rather than via a direct dependency.
In a project which doesn't use @fluentui/react
, you can still install this package as a dependency:
npm install --save @fluentui/style-utilities
This gives you access to styling-related constants, utilities, and Fabric Core style classes through JavaScript.
FAQs
Styling helpers for Fluent UI React.
The npm package @fluentui/style-utilities receives a total of 56,323 weekly downloads. As such, @fluentui/style-utilities popularity was classified as popular.
We found that @fluentui/style-utilities demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.