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.
@uifabric/styling
Advanced tools
Defines the core Office UI Fabric styles through a JavaScript interface.
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.
Within an npm project, you should install the package and save it as a dependency:
npm install --save @uifabric/styling
This will add the styling package which gives you access to the Fabric Core style classes through JavaScript.
Fonts, colors, icons and animations are exported through the classNames
export. The export exposes class names for colors
, fonts
, animations
, and icons
.
Example of returning markup that is themePrimary
colored using the medium
font:
import {
colorClassNames,
fontClassNames
} from '@uifabric/styling';
function renderHtml() {
return (
`<div class="${ [
colorClassNames.themePrimary,
fontClassNames.medium
].join(' ') }">Hello world!</div>`
);
}
There are a number of classes available under colorClassNames
, fontClassNames
, animationClassNames
, and iconClassNames
exports. See the available classes below.
Using animations works the same way:
import {
animationClassNames
} from '@uifabric/styling';
function renderHtml() {
return (
`<div class="${ animationClassNames.fadeIn }">Hello world!</div>`
);
}
Rendering icons is also simplified:
import {
iconClassNames
} from '@uifabric/styling';
function renderHtml() {
return (
`<i class="${ iconClassNames.snow }" />`
);
}
If you need access to the raw JavaScript style objects so that you can mix them into other classes and use via a css library such as Glamor or Aphrodite, you can access the raw classes like so:
import {
fontStyles
} from '@uifabric/styling';
import { css } from 'glamor';
function renderHtml() {
let className = css({
...styles.fonts.large,
background: 'red'
});
return (
`<div class="${ css(fontStyles.large, { background: 'red' }) }">Hello!</div>`
);
}
The default palette of colors matches the default Fabric core styling conventions. However, it is possible to override the color slots to match your product requirements:
import {
loadTheme({
colors: {
themePrimary: 'red',
themeSeconary: 'blue'
},
fonts: {
medium: {
fontFamily: 'Courier New',
fontSize: '12px'
}
}
});
}
If you override theme settings, you need to do this before accessing theme colors. Otherwise you won't get a notification that the theme changed.
Members of classNames.colors
:
Name | Description |
---|
Members of classNames.fonts
:
Name | Description |
---|
Members of classNames.animations
:
Name | Description |
---|
Members of classNames.icons
:
Name | Description |
---|
FAQs
Styling helpers for Fluent UI React.
The npm package @uifabric/styling receives a total of 11,603 weekly downloads. As such, @uifabric/styling popularity was classified as popular.
We found that @uifabric/styling demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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.