Skip to main content

Radii

Interface

Structure

interface Radii {
[key: string]: string;
}

type Radius = keyof Radii;

Usage

// Types are re-exported for ease of use by other packages
// like @morfeo/core, @morfeo/web or @morfeo/react
import { Radius, Radii } from '@morfeo/spec';

Examples

Using the CLI compose command:

radii.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 radii.morfeo.ts
export const sliceName = 'radii';

export default {
'2xs': '4px',
xs: '8px',
s: '12px',
m: '16px',
l: '20px',
xl: '24px',
'2xl': '28px',
none: '0px',
round: '50%',
};

Or manually:

radii.ts
import { Radii } from '@morfeo/spec';

const radii: Radii = {
'2xs': '4px',
xs: '8px',
s: '12px',
m: '16px',
l: '20px',
xl: '24px',
'2xl': '28px',
none: '0px',
round: '50%',
};
theme.ts
import { radii } from './radii';

const myTheme = {
radii,
...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
borderRadiusborderRadius{ borderRadius: "l"} {"borderRadius":"20px"}
borderEndEndRadiusborderEndEndRadius{ borderEndEndRadius: "l"} {"borderEndEndRadius":"20px"}
borderTopLeftRadiusborderTopLeftRadius{ borderTopLeftRadius: "l"} {"borderTopLeftRadius":"20px"}
borderEndStartRadiusborderEndStartRadius{ borderEndStartRadius: "l"} {"borderEndStartRadius":"20px"}
borderTopRightRadiusborderTopRightRadius{ borderTopRightRadius: "l"} {"borderTopRightRadius":"20px"}
borderStartEndRadiusborderStartEndRadius{ borderStartEndRadius: "l"} {"borderStartEndRadius":"20px"}
borderStartStartRadiusborderStartStartRadius{ borderStartStartRadius: "l"} {"borderStartStartRadius":"20px"}
borderBottomLeftRadiusborderBottomLeftRadius{ borderBottomLeftRadius: "l"} {"borderBottomLeftRadius":"20px"}
borderBottomRightRadiusborderBottomRightRadius{ borderBottomRightRadius: "l"} {"borderBottomRightRadius":"20px"}
cornerborderRadius{ corner: "l"} {"borderRadius":"20px"}
cornerEndEndborderEndEndRadius{ cornerEndEnd: "l"} {"borderEndEndRadius":"20px"}
cornerTopLeftborderTopLeftRadius{ cornerTopLeft: "l"} {"borderTopLeftRadius":"20px"}
cornerEndStartborderEndStartRadius{ cornerEndStart: "l"} {"borderEndStartRadius":"20px"}
cornerTopRightborderTopRightRadius{ cornerTopRight: "l"} {"borderTopRightRadius":"20px"}
cornerStartEndborderStartEndRadius{ cornerStartEnd: "l"} {"borderStartEndRadius":"20px"}
cornerStartStartborderStartStartRadius{ cornerStartStart: "l"} {"borderStartStartRadius":"20px"}
cornerBottomLeftborderBottomLeftRadius{ cornerBottomLeft: "l"} {"borderBottomLeftRadius":"20px"}
cornerBottomRightborderBottomRightRadius{ cornerBottomRight: "l"} {"borderBottomRightRadius":"20px"}

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 Radii 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 { radii } from './path/to/your/custom/radii';

type MyRadii = typeof radii;

declare module '@morfeo/spec' {
export interface Radii extends MyRadii {}
}

Read more about how to extend the default Morfeo Theme here.