useContentTypes

useContentTypes(
  options?: ContentTypeOptions,
  deps?: any[]): IContentTypeInfo[] | null | undefined;

Returns content types of web or list. Use ContentTypeOptions.list property to get list content types instead of web content types.

Examples

Get web content types,

const webContentTypes = useContentTypes();

Get list content types by list Id,

const listContentTypes = useContentTypes({
  list: "5ee53613-bc0f-4b2a-9904-b21afd8431a7"
});

Get list content types by list title,

const listContentTypes = useContentTypes({
  list: "My List Title"
});

Parameters

NameTypeDescriptionTracked for changes
options?ContentTypeOptionsuseContentTypes hook options.Partially
deps?DependencyListHook dependency listYes