Responsive
Easily manage values that can be set per-breakpoint.
<Responsive icon={fontFamily} label='Font family' value={value} onChange={(value) => setValue(value)} options={[ { value: 'sans', label: 'Sans-serif' }, { value: 'serif', label: 'Serif' }, { value: 'mono', label: 'Monospace' }, ]} breakpoints={['mobile', 'tablet', 'desktop', 'large']} breakpointData={{ mobile: 480, tablet: 960, desktop: 1440, large: 1920, }}> {({ currentValue, handleChange, options }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} /> )}</Responsive>Highlighted props
Section titled “Highlighted props”For the complete list of props, use your IDE’s autocomplete functionality.
Inline
Section titled “Inline”<Responsive icon={fontFamily} label='Font family' value={value} onChange={(value) => setValue(value)} options={[ { value: 'sans', label: 'Sans-serif' }, { value: 'serif', label: 'Serif' }, { value: 'mono', label: 'Monospace' }, ]} breakpoints={['mobile', 'tablet', 'desktop', 'large']} breakpointData={{ mobile: 480, tablet: 960, desktop: 1440, large: 1920, }} inline> {({ currentValue, handleChange, options }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} /> )}</Responsive>Different control when inline (collapsed view)
Section titled “Different control when inline (collapsed view)”<Responsive icon={fontFamily} label='Font family' value={value} onChange={(value) => setValue(value)} options={[ { value: 'sans', label: 'Sans-serif' }, { value: 'serif', label: 'Serif' }, { value: 'mono', label: 'Monospace' }, ]} breakpoints={['mobile', 'tablet', 'desktop', 'large']} breakpointData={{ mobile: 480, tablet: 960, desktop: 1440, large: 1920, }} inline> {({ currentValue, handleChange, options, isInlineCollapsedView }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} type={isInlineCollapsedView ? 'menu' : 'toggleButtons'} /> )}</Responsive>Different control when inline (expanded view)
Section titled “Different control when inline (expanded view)”<Responsive icon={fontFamily} label='Font family' value={value} onChange={(value) => setValue(value)} options={[ { value: 'sans', label: 'Sans-serif' }, { value: 'serif', label: 'Serif' }, { value: 'mono', label: 'Monospace' }, ]} breakpoints={['mobile', 'tablet', 'desktop', 'large']} breakpointData={{ mobile: 480, tablet: 960, desktop: 1440, large: 1920, }} inline> {({ currentValue, handleChange, options, isInlineExpandedView }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} type={isInlineExpandedView ? 'radiosSegmented' : 'toggleButtons'} /> )}</Responsive>Disable desktop-first/mobile-first picker
Section titled “Disable desktop-first/mobile-first picker”<Responsive icon={fontFamily} label='Font family' value={value} onChange={(value) => setValue(value)} options={[ { value: 'sans', label: 'Sans-serif' }, { value: 'serif', label: 'Serif' }, { value: 'mono', label: 'Monospace' }, ]} breakpoints={['mobile', 'tablet', 'desktop', 'large']} breakpointData={{ mobile: 480, tablet: 960, desktop: 1440, large: 1920, }} noModeSelect> {({ currentValue, handleChange, options }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} /> )}</Responsive>MiniResponsive
Section titled “MiniResponsive”If you need an ultra compact version of the Responsive component, use the MiniResponsive component. Props are all the same.
Using single button pickers is recommended, though. (isInlineCollapsedView is your friend here)
<MiniResponsive icon={fontFamily} label='Font family' value={data} onChange={setData} options={responsiveOptions} breakpoints={breakpointNames} breakpointData={globalManifest.globalVariables.breakpoints}> {({ currentValue, handleChange, options, isInlineCollapsedView }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} type={isInlineCollapsedView ? 'menu' : 'toggleButtons'} /> )}</MiniResponsive>ResponsiveLegacy
Section titled “ResponsiveLegacy”Props are mostly the same as in the Responsive component.
Main differences:
- there is not desktop-first/mobile-first mode switcher
- there is no Responsive preview
<ResponsiveLegacy icon={fontFamily} label='Font family' attribute={manifest.responsiveAttributes.myAttr} value={attributes} onChange={(attributeName, newValue) => { setAttributes({ ...attributes, [attributeName]: newValue, }); }} options={[ { value: 'sans', label: 'Sans-serif' }, { value: 'serif', label: 'Serif' }, { value: 'mono', label: 'Monospace' }, ]} breakpointData={globalManifest.globalVariables.breakpoints}> {({ currentValue, handleChange, options }) => ( <OptionSelect options={options} onChange={(value) => handleChange(value)} value={currentValue} /> )}</ResponsiveLegacy>Inherited values
Section titled “Inherited values”The default value that marks an attribute as inherited from the breakpoint above is an empty string.
To set a custom one, use the inheritValue prop.
If you need the inherited value to be undefined, set the allowUndefined prop instead.