Skip to main content

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:

namecss propertyexampleoutput
borderStyleborderStyle{ borderStyle: "groove"} {"borderStyle":"groove"}
borderTopStyleborderTopStyle{ borderTopStyle: "groove"} {"borderTopStyle":"groove"}
borderLeftStyleborderLeftStyle{ borderLeftStyle: "groove"} {"borderLeftStyle":"groove"}
borderRightStyleborderRightStyle{ borderRightStyle: "groove"} {"borderRightStyle":"groove"}
borderBlockStyleborderBlockStyle{ borderBlockStyle: "groove"} {"borderBlockStyle":"groove"}
borderBottomStyleborderBottomStyle{ borderBottomStyle: "groove"} {"borderBottomStyle":"groove"}
borderInlineStyleborderInlineStyle{ borderInlineStyle: "groove"} {"borderInlineStyle":"groove"}
borderBlockEndStyleborderBlockEndStyle{ borderBlockEndStyle: "groove"} {"borderBlockEndStyle":"groove"}
borderInlineEndStyleborderInlineEndStyle{ borderInlineEndStyle: "groove"} {"borderInlineEndStyle":"groove"}
borderBlockStartStyleborderBlockStartStyle{ borderBlockStartStyle: "groove"} {"borderBlockStartStyle":"groove"}
borderInlineStartStyleborderInlineStartStyle{ 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.