Issue #975✓ SolvedOpened Mar 22, 2018by rajanbharti4 reactions

Default values for traits field

Quick answerby artf3

Traits should read the default directly from their props/attributes, so in your case, it should be something like this:

Read full answer below ↓

Question

I have created component with certain traits. I am not able to assign default value to traits by passing values. It is coming as undefined for color type, blank for text field. Any changes in field is getting reflected in component

Answers (3)

👍 Most helpfulartfMar 24, 2018

Traits should read the default directly from their props/attributes, so in your case, it should be something like this:

rajanbhartiSep 13, 2018

in your case, defaults should be like typeid: 0 pointing to the first element as default

rajanbhartiMar 24, 2018

Thanks!

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.