Skip to content

CoreHeadingBlock

Daniel Milner edited this page Sep 3, 2019 · 1 revision

This component displays heading blocks from Gutenberg.

Import the component

import { CoreHeadingBlock ] from 'wp-block-components';

Usage

<CoreHeadingBlock attributes={{
    content: 'This is a heading',
    align: null,
    anchor: null,
    className: null,
    level: 2
  }} />

GraphQL Fragment

You can use the following GraphQL fragment to retrieve the appropriate fields from WPGraphQL.

... on CoreHeadingBlock {
    name
    attributes {
      __typename
      ... on CoreHeadingBlockAttributes {
        align
        anchor
        className
        content
        level
      }
    }
  }

Both CoreHeadingBlock and CoreHeadingBlockAttributes may have an additional prefix. For example, if you are using Gatsby, you may have named your WPGraphQL source WPGraphQL, so CoreHeadingBlock would become WPGraphQL_CoreHeadingBlock, etc.

Clone this wiki locally