Components:Style names & overwrites - bettyblocks/cli GitHub Wiki

Using style names & overwrites

Currently you're able to style your components using the style tab within Betty Blocks. But sometimes you want a prefab to have certain styling the moment it is dropped on the page without the no-coder having to change this themselves. In this case you could use style names & overwrites.

Types of styling

There are 2 ways styles can be defined within a prefab, you can either refer to a style name that exists within your betty application, or use style overwrites.

Referring to an existing style with style name

When a prefab is dropped that contains a style name, the IDE will check to see if a style with this name exists in the application. If that is the case, this style will be selected by default, and applied directly to the dropped component.

style: {
  name: 'outline'
}

Styling with style overwrites

Style overwrites give you more flexibility, you can specify exact overwrites that this style should have.

style: {
  overwrite: {
    textDecoration: 'underline'
  }
}

This change will have the underline option set by default.

Combining style names & overwrites

You are also able to use names and overwrites together. This way you can use an existing style like outlined, and have overwritten styles above it.

style: {
  name: 'outline',
  overwrite: {
    textDecoration: 'underline'
  }
}

Limitations

Currently the style editor is limited to the Button component

Supported components

Button - Overwrite Options

backgroundColor

Accepts an object with two required properties:

  • type: 'STATIC' | 'THEME_COLOR'
  • value: string
overwrite: {
  backgroundColor: {
   type: 'STATIC',
   value: 'red'
  }
}

If 'THEME_COLOR' is provided as type, the 'value' has to point to an existing key on the theme colors.

borderColor

Accepts an object with two required properties:

  • type: 'STATIC' | 'THEME_COLOR'
  • value: string
overwrite: {
  borderColor: {
   type: 'STATIC',
   value: 'red'
  }
}

If 'THEME_COLOR' is provided as type, the 'value' has to point to an existing key on the theme colors.

borderRadius

Accepts an array with maximum one required element which can be any 'rem' value:

  • string[]
overwrite: {
  borderRadius: ['0.125rem']
}

borderStyle

Accepts a string:

  • string
overwrite: {
  borderStyle: 'solid'
}

borderWidth

Accepts an array with maximum one required element which can be any 'rem' value:

  • string[]
overwrite: {
  borderWidth: ['0.25rem']
}

boxShadow

Accepts a string with one of the following values:

  'none',
  '0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)',
  '0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)',
  '0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)',
  '0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)',
  '0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)',
  '0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)',
  '0px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)',
  '0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)',
  '0px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)',
  '0px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)',
  '0px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)',
  '0px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)',
  '0px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)',
  '0px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)',
  '0px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)',
  '0px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)',
  '0px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)',
  '0px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)',
  '0px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)',
  '0px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)',
  '0px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)',
  '0px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)',
  '0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)',
  '0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)',
  • string
overwrite: {
  boxShadow: '0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)'
}

color

Accepts an object with two required properties:

  • type: 'STATIC' | 'THEME_COLOR'
  • value: string
overwrite: {
  color: {
   type: 'STATIC',
   value: 'blue'
  }
}

If 'THEME_COLOR' is provided as type, the 'value' has to point to an existing key on the theme colors.

fontFamily

Accepts a string with one of the following values:

Roboto
serif
sans-serif
monospace
  • string
overwrite: {
  fontFamily: 'Roboto'
}

fontSize

Accepts a string with any 'rem' value:

  • string
overwrite: {
  fontSize: '1.25rem'
}

fontStyle

Accepts a string with one of the following values:

italic
none
  • string
overwrite: {
  fontStyle: 'italic'
}

fontWeight

Accepts a string with one of the following values:

300
400
500
700
  • string
overwrite: {
  fontWeight: '400'
}

letterSpacing

Accepts a string with any 'rem' value:

  • string
overwrite: {
  letterSpacing: '0.0625rem'
}

lineHeight

Accepts a string with any number value:

  • string
overwrite: {
  lineHeight: '1'
}

padding

Accepts a array of strings with at least one and maximum 4 items which can be any 'rem' value:

  • string[]
overwrite: {
  padding: ['1.25rem', '0.5rem']
}

textDecoration

Accepts a string with one of the following values:

underline
none
  • string
overwrite: {
  textDecoration: 'none'
}

textTransform

Accepts a string with one of the following values:

uppercase
none
  • string
overwrite: {
  textTransform: 'uppercase'
}