fabric.styling

Document{}

implicit

Type members

Classlikes

@native @JSType
trait IAnimationClassNames extends Object
@native @JSType
trait IAnimationStyles extends Object
@JSType
trait IClassNamesTag extends Object

Tag for an object whose data memebers all returns strings (= classnames). You must promise to only have these type of members in the object.

Tag for an object whose data memebers all returns strings (= classnames). You must promise to only have these type of members in the object.

@native @JSType
trait IColorClassNames extends Object
@native @JSType
trait IEffects extends Object
@native @JSType
trait IFontClassNames extends Object
@native @JSType
trait IFontSizes extends Object
@native @JSType
trait IFontStyles extends Object
@native @JSType
trait IFontWeights extends Object
@native @JSType
trait IIconFontSizes extends Object
@JSType
trait IIconOptions extends Object
@JSType
trait IIconSubset extends Object
@native @JSType
trait IPalette extends Object
@JSType
trait IRawStyle extends IRawStyleBase
@JSType
trait IRawStyleArray extends Array[IStyle]
@native @JSType
trait ISemanticColors extends Object
@native @JSType
trait ISpacing extends Object
@JSType
trait IStyleOptions extends Object
@JSType
trait IStyleSetTag extends Object

Tag your style trait to help drive style inference. You must promise to only have specific types of values in your trait. Generally, your member types will all be var stylename: js.UndefOr[IStyle] so that you can specific a subset of the members based on your need. This is for use to create a statically typed version of IStyleSet (a dictionary) where the members are statically declared as trait data members. Implicit conversions are available to convert a js.Object to a IStyleSet to call the interop functions. You must promise to only have IStyle or js.UndefOr[IStyle] objects as values.

Tag your style trait to help drive style inference. You must promise to only have specific types of values in your trait. Generally, your member types will all be var stylename: js.UndefOr[IStyle] so that you can specific a subset of the members based on your need. This is for use to create a statically typed version of IStyleSet (a dictionary) where the members are statically declared as trait data members. Implicit conversions are available to convert a js.Object to a IStyleSet to call the interop functions. You must promise to only have IStyle or js.UndefOr[IStyle] objects as values.

@JSType
trait IStylesheetConfig extends Object
@native @JSType
trait IVendorSettings extends Object
@native @JSType
sealed
trait InjectionMode extends Any
Companion
object
Companion
class
@native @JSType
trait MergeStyles extends Object

uifabric/merge-styles.

uifabric/merge-styles.

@native @JSType
trait StyleSetArg extends Object

Magnet pattern for concatStyleSetsWithProps.

Magnet pattern for concatStyleSetsWithProps.

Companion
object
Companion
class
@native @JSImport("@uifabric/merge-styles/lib/styleToClassName") @JSType
object StyleToClassName extends Object

Totally odd that this is not included in the overall Styling exports.

Totally odd that this is not included in the overall Styling exports.

@native @JSType
trait Stylesheet extends Object
@native @JSType
trait StylingLike extends Object
@native @JSImport("@uifabric/styling") @JSType
object module extends Object with styles_CommonStyles with ThemeLike with StylingLike with MergeStyles
object selectorset extends MakeSelectors

Helper to create entries for the selectors propert on IRawStyle.

Helper to create entries for the selectors propert on IRawStyle.

object stylearray extends MakeStyles

Create an array of styles. This should really have IStyleBase as input.

Create an array of styles. This should really have IStyleBase as input.

object styles extends MakeStyles

Create an array of styles. This should really have IStyleBase as input. Same as stylearray.

Create an array of styles. This should really have IStyleBase as input. Same as stylearray.

@native @JSType
trait styles_Common extends Object
@native @JSType
trait styles_CommonStyles extends Object
object styleset

Create a style set. You can use this to help drive type inference or you can use a JS trait directly (see make and IStyleSetTag). Use this helper when you want an explicit IStyleSet but generally you should create style objects and tag them with IStyleSetTag.

Create a style set. You can use this to help drive type inference or you can use a JS trait directly (see make and IStyleSetTag). Use this helper when you want an explicit IStyleSet but generally you should create style objects and tag them with IStyleSetTag.

Example
mergeStyleSets[SomeClassNames](
styleset(
  "root" -> stylearray(
    "xx-PartName",
    new IRawStyle { ... },
    if(something) null else new IRawStyle { ... },
    customStyles.flatMap(_.root)
)
)
object subcomponentstyles extends MakeSubcomponentStyles

Helper to create entries for the selectors propert on IRawStyle.

Helper to create entries for the selectors propert on IRawStyle.

Deprecated classlikes

@deprecated("Use fabric.styling.module") @native @JSImport("@uifabric/styling") @JSType
object Styling extends Object with ThemeLike with StylingLike with MergeStyles

uifabric/styling == office-ui-fabric-react/lib/Styling. @uifabric/styling also exports most of @uifabic/merge-styles. This should really be the module.

uifabric/styling == office-ui-fabric-react/lib/Styling. @uifabric/styling also exports most of @uifabic/merge-styles. This should really be the module.

Deprecated

Types

type GetClassNamesFn[SP <: Any, S <: IStyleSetTag, C <: IClassNamesTag] = Function2[SP, UndefOr[IStyleFunctionOrObject[SP, S]], C]

Type for a logical getClassNames function declared as a val. Use this if you need to memoize the function and use js memoization. If all you do is call getClassNames inside a useMemo hook, then you can define your component's getClassNames as a standard scala function.

Type for a logical getClassNames function declared as a val. Use this if you need to memoize the function and use js memoization. If all you do is call getClassNames inside a useMemo hook, then you can define your component's getClassNames as a standard scala function.

Type Params
C

Class names object derived from IClassNamesTag.

S

Styles js object, derived from IStyleSetTag

SP

Style props

type IRawStyleBase = RawStyleBase
type ISelectorSet = Dictionary[Any]

Selector sets typically have styles but you could be defining a :global css var which may only have a value e.g. a string color or number.

Selector sets typically have styles but you could be defining a :global css var which may only have a value e.g. a string color or number.

A simple style object/string/thing or an array of those. A plain string becomes a classname in mergestyles.

A simple style object/string/thing or an array of those. A plain string becomes a classname in mergestyles.

type IStyleBase = IRawStyle | String | Dynamic | Object

Added js.Dynamic so you can add anything dynamically, which is not typesafe but it is convenient! Should we keep js.Object to the union? Allows us to define and use some non-native JS traits but is also a bit loosely typed.

Added js.Dynamic so you can add anything dynamically, which is not typesafe but it is convenient! Should we keep js.Object to the union? Allows us to define and use some non-native JS traits but is also a bit loosely typed.

type IStyleFn[SP <: Any, SS <: IStyleSetTag] = Function1[SP, SS]
type IStyleFunction[SP <: Any, SS <: IStyleSetTag] = Function1[SP, SS]

Convert style props to a style set. Declare your props=>styleset functions with this type e.g. val getStyles: IStyleFunction[SP, SST] = props => new Styles { ... }. However, its easier to use the smart constructor stylingFunction.

Convert style props to a style set. Declare your props=>styleset functions with this type e.g. val getStyles: IStyleFunction[SP, SST] = props => new Styles { ... }. However, its easier to use the smart constructor stylingFunction.

Type Params
SP

style props type

SS

Style set type e.g. IStyleSet or js object derived from IStyleSetTag

type IStyleFunctionOrObject[SP <: Any, SS <: IStyleSetTag] = Function1[SP, SS] | SS

A style set or a style function. This mirrors the fabric signature.

A style set or a style function. This mirrors the fabric signature.

Type Params
SP

style props type

SST

style set type e.g. IStyleSet or IStyleSetTag

type IStyleSet = Dictionary[IStyle]

Keys are usually the logical names of your component, e.g. root, header, footer. Fabric also desginates subComponentStyles as a property that is an object with string->istyle mappings or a function that takes properties (an object) and returns string->istyle mappings. So fabric defines a style set as a potentially hierarchical specification of stylesets. When you want to be specific, use a trait instead of IStyleSet. Most of your code should use IStyleSetTag js objects with explicitly defined data members and rely on implicit conversions from IStyleSetTag to IStyleSet defined for convenience when calling the fabric style functions. Should this really be js.Dictonary[js.UndefOr[IStyle]?

Keys are usually the logical names of your component, e.g. root, header, footer. Fabric also desginates subComponentStyles as a property that is an object with string->istyle mappings or a function that takes properties (an object) and returns string->istyle mappings. So fabric defines a style set as a potentially hierarchical specification of stylesets. When you want to be specific, use a trait instead of IStyleSet. Most of your code should use IStyleSetTag js objects with explicitly defined data members and rely on implicit conversions from IStyleSetTag to IStyleSet defined for convenience when calling the fabric style functions. Should this really be js.Dictonary[js.UndefOr[IStyle]?

Value members

Concrete methods

def stylingFunction[SP <: Any, SS <: IStyleSetTag](f: SP => SS): Function1[SP, SS]

Smart constructor with better type inference to define a IStyleFunction as a val. Use this whene you need to keep the type as a function.

Smart constructor with better type inference to define a IStyleFunction as a val. Use this whene you need to keep the type as a function.

def stylingFunctionOr[SP <: Any, SS <: IStyleSetTag](f: SP => SS): IStyleFunctionOrObject[SP, SS]

Smart constructor with better type inference to define a IStyleFunctionOrObject as a val. Use this when you need to pass your styling function to fabric's functions but don't need to call it yourself.

Smart constructor with better type inference to define a IStyleFunctionOrObject as a val. Use this when you need to pass your styling function to fabric's functions but don't need to call it yourself.

def toStyleSetArgs[StyleProps <: Object, Styles <: IStyleSetTag](args: Seq[UndefOr[IStyleFunctionOrObject[StyleProps, Styles]]]): Seq[StyleSetArg]

Combine IStyleFunction, IStyleFunctionOrObject into a single array of type StyleSetArg needed for the args in concatStyleSets or concatStyleSetsWithProps. Helps with type inference and composing args for varargs.

Combine IStyleFunction, IStyleFunctionOrObject into a single array of type StyleSetArg needed for the args in concatStyleSets or concatStyleSetsWithProps. Helps with type inference and composing args for varargs.

Deprecated methods

@deprecated("Use concatStyleSetsWithProps")
def resolve[SP <: Any, SS <: IStyleSetTag](props: SP, styles: UndefOr[IStyleFunctionOrObject[SP, SS]]*): SS

Given some props and a list of IStyleFunctionOrObjects, resolve to a single (string->IStyle) by either calling the style function with the props or just using the props. Calls Styling.concatStyleSheets to properly recursively merge the data. This function is kept js oriented to match _resolve in the fabric styled HOC module (@uifabric/utilities/styled). Note that @merge-styles/concatStylesSetsWithProps can perform this processing.

Given some props and a list of IStyleFunctionOrObjects, resolve to a single (string->IStyle) by either calling the style function with the props or just using the props. Calls Styling.concatStyleSheets to properly recursively merge the data. This function is kept js oriented to match _resolve in the fabric styled HOC module (@uifabric/utilities/styled). Note that @merge-styles/concatStylesSetsWithProps can perform this processing.

Deprecated

Implicits

Implicits

implicit
def dyn2IStyle(d: Dynamic): IStyle

Any old dynamic maps to a style since we don't know what's in it so be hopeful. @group converters

Any old dynamic maps to a style since we don't know what's in it so be hopeful. @group converters

implicit
implicit
def jsObject2IStyleSet[T <: Object](u: T): IStyleSet
implicit
def jsUndefOrJsObject2IStyleSet[T <: Object](u: UndefOr[T]): IStyleSet
implicit
def null2IStyle(n: Null): IStyle

Convert null to style. @group converters

Convert null to style. @group converters

implicit
def stringOpt2IStyle(sopt: Option[String]): IStyle | Null

Unwrap the string or return null. @group converters

Unwrap the string or return null. @group converters

implicit
def stringUndefOr2IStyle(sopt: UndefOr[String]): IStyle

Unwrap the string or return null. @group converters

Unwrap the string or return null. @group converters

implicit
def styleAttr2IRawStyleBase(arr: StyleAttr): IStyle

Convert standard vdom StyleAttr to IStyle. @grop converters

Convert standard vdom StyleAttr to IStyle. @grop converters

implicit
def styleOpt2IStyle(vopt: Option[IStyle]): IStyle | Null

Unwrap the option or return null. @group converters

Unwrap the option or return null. @group converters

implicit
def undef2IStyle(vopt: UndefOr[IStyle]): IStyle

Directly convert to a style since undefined is valid. @group coneverters

Directly convert to a style since undefined is valid. @group coneverters

implicit
def undefOrJsObject2IStyle(u: UndefOr[Object]): IStyle

Map a UndefOr to IStyle directly. @group converters

Map a UndefOr to IStyle directly. @group converters