Skip to content

Spacing

Spacing component

Basic

Margin

0

0

0

0

Padding

0

0

0

0

html
<HLBuilderSpace :margin-values="marginValues" :padding-values="paddingValues" />
ts
const marginValues = ref({
  top: '20px',
  bottom: '20px',
  right: '-100px',
  left: 'auto',
})
const paddingValues = ref({
  top: '2rem',
  bottom: '20px',
  right: '20em',
  left: '20%',
})

Invalid Data

Margin

0

0

0

0

Padding

0

0

0

0

html
<HLBuilderSpace :margin-values="invalidMarginValues" :padding-values="invalidPaddingValues" />
ts
const invalidMarginValues = ref({
  top: '👾',
  bottom: '👾',
  right: '👾',
  left: '👾',
})
const invalidPaddingValues = ref({
  top: '🚀',
  bottom: '0px',
  right: '🚀',
  left: '🚀',
})

Unit Customization

Margin

0

0

0

0

Padding

0

0

0

0

html
<HLBuilderSpace :margin-values="marginValues" :padding-values="paddingValues" :margin-units-config="marginUnitsConfig" />
ts
const marginUnitsConfig = ref(['rem', 'em'])

Only Specific Directions

Margin

0

0

Padding

0

0

Vue
html
<HLBuilderSpace
  :margin-values="marginValues"
  :padding-values="paddingValues"
  :allowed-margin-directions="['top', 'bottom']"
  :allowed-padding-directions="['right', 'left']"
/>

Import

ts
import { HLBuilderSpace } from '@platform-ui/highrise'

Props

PropTypeDefaultDescription
margin-valuesObject{top: 'auto', bottom: 'auto', left: 'auto', right: 'auto'}Margin object with pre applied values
padding-valuesObject{ top: '0px', bottom: '0px', left: '0px', right: '0px' }Padding object with pre applied values
margin-units-configArray['px','%','rem','em','vw','vh',]List of units that are allowed for margin values, that will be shown in the dropdown
padding-units-configArray['px','%','rem','em','vw','vh',]List of units that are allowed for padding values, that will be shown in the dropdown
allowed-margin-directionsArray['top', 'bottom', 'right', 'left']Use this to customise certain margin directions. Only the passed values will be shown
allowed-padding-directionsArray['top', 'bottom', 'right', 'left']Use this to customise certain padding directions. Only the passed values will be shown
margin-readonlyBooleanfalseMakes ALL margin inputs as read-only margin values
padding-readonlyBooleanfalseMakes ALL padding inputs as read-only padding values
dropdown-placement'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end'topDropdown position for both margin and padding
error-msgStringProvided value is invalidCustom message to be passed for error validations
disable-dragBooleanfalseDisables dragging on the spacing trigger

Emits

EventParamsDescription
update:value{changed: { spaceType: { position: value } }, value: Number, unit: String, numericValue: Number}Update value