@frontify/guideline-blocks-settings

Provides the types for the block settings

Usage no npm install needed!

<script type="module">
  import frontifyGuidelineBlocksSettings from 'https://cdn.skypack.dev/@frontify/guideline-blocks-settings';
</script>

README

Block Settings

Provides the block settings types for the guideline-blocks.

Example

import { Bundle, BlockSettings } from '@frontify/guideline-blocks-settings';
import { IconEnum } from '@frontify/arcade';

const Settings: BlockSettings = {
    main: [
        {
            id: 'example',
            type: 'dropdown',
            size: 'Large',
            defaultValue: 'solid',
            choices: [
                {
                    value: 'noline',
                    icon: IconEnum.LineSpacer,
                    label: 'Spacer (no line)',
                },
                {
                    value: 'solid',
                    icon: IconEnum.LineSolid,
                    label: 'Line',
                },
            ],
            onChange: (bundle: Bundle): void => {
                const blockWidth = Number(bundle.getBlock('widthCustom')?.value);
                if (!Number.isNaN(blockWidth)) {
                    bundle.setBlockValue('widthCustom', `${blockWidth}%`);
                }
            },
        },
    ],