Gutenberg: Add attribute types to docs

Created on 12 Jun 2019  路  6Comments  路  Source: WordPress/gutenberg

When registering a block you can define the attributes and their types, but I can't find any docs detailing what the allowed types are.

https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-attributes.md

I can guess what some of them are, but what about boolean? Is it boolean or bool? And number/ int/ float/ all of the above?

I think a proper list would be very helpful.

Thanks

Good First Issue [Type] Documentation

All 6 comments

I agree it should be documented more explicitly. To answer, the types support is meant to align with JSON Schema types, similar to that of the schemas used in registering REST routes server-side.

https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1

Thanks - that helps.

I can work on getting this info stated explicitly on the documentation, if still needed!

@AdamDTak2112 That would be awesome!

@chrisvanpatten Perfect. Should I include the Schema page that @aduth posted above listing the various types, or are a brief list enough for the developer to understand?

@AdamDTak2112 I think a brief list would be a good starting point, and also maybe link out to the Schema docs for the WP REST API: https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aduth picture aduth  路  3Comments

davidsword picture davidsword  路  3Comments

moorscode picture moorscode  路  3Comments

mhenrylucero picture mhenrylucero  路  3Comments

ellatrix picture ellatrix  路  3Comments