✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Controlling the size of a block field in Sanity.io

7 replies
Last updated: Feb 8, 2021
Hi! I have a block with one decorator - it's only used to set part of the text as pink. Is there a way of limiting rows of block same as we can do with type 'text'? It won't ever be a long text and at the moment it takes a few rows. Or maybe there is a better way than using a block if I need only one decorator?
Feb 8, 2021, 1:39 PM
Hi User. I'm curious what you mean by "limiting rows" and "it takes a few rows." If you don't mind, could you please show what you're getting and describing what you want instead? Thanks!
Feb 8, 2021, 3:02 PM
Sorry for not explaining properly. I mean the size of this field.In type text we have "
rows -Controls the number of rows/lines in the rendered textarea. Default number of rows: 
Feb 8, 2021, 3:24 PM
I'm using https://www.sanity.io/docs/block-type and wondered if there is a way of controlling the amount of these rows/lines. ?The use case in here is I can have text like this "this is my
pinkword text", that's why I'm using the block type as you can see on the screen. But the text won't ever be very long, as it's mostly used for section titles.
Feb 8, 2021, 3:27 PM
      title: "Text Field",
      name: "text",
      type: "array",
      description: "Use the P to mark part of text as pink",
      of: [
          type: "block",
          lists: [],
          marks: {
            decorators: [pinkDecorator],
            annotations: [],

Feb 8, 2021, 3:29 PM
It's purely about how much space this text field takes in the sanity.Like in here in case of text type:

      title: "Text",
      name: "text",
      type: "text",
      rows: 2,
Feb 8, 2021, 3:29 PM
Thanks User! I appreciate you helping me understand. I’m afraid I’m not aware of a way to control the number of rows for the Portable Text editor. It may be complicated by the fact that it is expandable (to fullscreen). You could put it in a collapsible object if you want to keep it out of sight.
Feb 8, 2021, 3:57 PM
I see. Thank you for your time! 🙂
Feb 8, 2021, 4:02 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?