[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)
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'],
}
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.
Issue #1169
[Question] Get and set some styles to active element (in components)
Is it possible to have some style attributes, for example, color, background-color, font-size, in component settings tab, together with tra...
Issue #1428
[Question] Define or hide properties for specific components
Hi, I'm wondering if there is the possibility to define properties for specific components. I mean, when I select the component Image I wou...
Issue #1994
[question] Is it possible to add StyleManager property for only class name
Thank for this awesome library. I am gonna to add style controller to sector. This style will be for only one class name and won't set targ...
Issue #460
When the component's view modifies the HTML, text components are no longer editable
I'm trying to build a custom component that contains some lorem ipsum text in the content, for editing once it's on the canvas. But I also...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.