Issue #917Opened March 1, 2018by chthomos0 reactions

[QUESTION] Custom style properties per element

Question

Is it possible to have custom style property UI per element.

For example, consider that I want the font-size to be shown as textbox for text components and as a radio for a custom component of mine.

The font-size property can be in the same sector.

How can this be achieved?

Answers (2)

artfMarch 4, 20180 reactions

Yes, I've used the same trick for the flex grid. In your Style Manager configuration create a property in this way

properties: [
	...
	{
		id: 'font-size-radio',
        type: 'radio',
        name: 'Font size (Radio)',
        property: 'font-size',
		options: [{...}, {...}],
		// With this option the proprty will be hidden 
		// until someone will not require it
		toRequire: true,
    },
	...
]

then in your custom component model require the property

defaults: {
	...,
	'stylable-require': ['font-size-radio'],
	// Probably in your case you might want to hide the original property
	// for this component
	'unstylable': ['font-size'], 
}
lock[bot]September 18, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.