BorderStyles
Interface
Structure
interface BorderStyles {
[key: string]: string;
}
type BorderStyle = keyof BorderStyles;
Usage
// Types are re-exported for ease of use by other packages
// like @morfeo/core, @morfeo/web or @morfeo/react
import { BorderStyle, BorderStyles } from '@morfeo/spec';
Examples
Using the CLI compose command:
borderStyles.morfeo.ts
// Remove this line to add the slice to all of your themes
export const themeName = 'My Theme Name';
// Optional if you name the file borderStyles.morfeo.ts
export const sliceName = 'borderStyles';
export default {
dashed: 'dashed',
dotted: 'dotted',
double: 'double',
groove: 'groove',
hidden: 'hidden',
none: 'none',
solid: 'solid',
};
Or manually:
borderStyles.ts
import { BorderStyles } from '@morfeo/spec';
const borderStyles: BorderStyles = {
dashed: 'dashed',
dotted: 'dotted',
double: 'double',
groove: 'groove',
hidden: 'hidden',
none: 'none',
solid: 'solid',
};
theme.ts
import { borderStyles } from './borderStyles';
const myTheme = {
borderStyles,
...restOfTheTheme,
};
morfeo.setTheme('My Theme Name', myTheme);
Properties
In this table is shown the property you pass to morfeo.resolve
, the actual CSS property or properties that will be generated,
an example of usage, and the correspondent output:
name | css property | example | output |
---|---|---|---|
borderStyle | borderStyle | { borderStyle: "groove"} | {"borderStyle":"groove"} |
borderTopStyle | borderTopStyle | { borderTopStyle: "groove"} | {"borderTopStyle":"groove"} |
borderLeftStyle | borderLeftStyle | { borderLeftStyle: "groove"} | {"borderLeftStyle":"groove"} |
borderRightStyle | borderRightStyle | { borderRightStyle: "groove"} | {"borderRightStyle":"groove"} |
borderBlockStyle | borderBlockStyle | { borderBlockStyle: "groove"} | {"borderBlockStyle":"groove"} |
borderBottomStyle | borderBottomStyle | { borderBottomStyle: "groove"} | {"borderBottomStyle":"groove"} |
borderInlineStyle | borderInlineStyle | { borderInlineStyle: "groove"} | {"borderInlineStyle":"groove"} |
borderBlockEndStyle | borderBlockEndStyle | { borderBlockEndStyle: "groove"} | {"borderBlockEndStyle":"groove"} |
borderInlineEndStyle | borderInlineEndStyle | { borderInlineEndStyle: "groove"} | {"borderInlineEndStyle":"groove"} |
borderBlockStartStyle | borderBlockStartStyle | { borderBlockStartStyle: "groove"} | {"borderBlockStartStyle":"groove"} |
borderInlineStartStyle | borderInlineStartStyle | { borderInlineStartStyle: "groove"} | {"borderInlineStartStyle":"groove"} |
Extend Slice with custom properties
If you're using typescript and you add custom colors to your theme configuration, you'll need to merge
the default BorderStyles
interface with your custom one.
We suggest creating a declaration file (for example: morfeo.d.ts
or types.d.ts
) like the following one:
import { borderStyles } from './path/to/your/custom/borderStyles';
type MyBorderStyles = typeof borderStyles;
declare module '@morfeo/spec' {
export interface BorderStyles extends MyBorderStyles {}
}
Read more about how to extend the default Morfeo Theme here.