---
title: "block"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/object/block'
  md: 'https://developer.shopline.com/docs/sline/object/block.md'
---

# block


    The content and settings of a block.

    Blocks are reusable content modules that make up a template. The `block` object is accessible only within HTML files located in the `blocks` directory.



    <div>
    
## Properties

        
<ObjectProperty 
    name="id"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The block ID, dynamically generated by SHOPLINE.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="settings"
    types={[<Mdx>[settings](https://developer.shopline.com/docs/sline/object/settings.md)</Mdx>]}
>
<ObjectSummary>
The settings of the block.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="shopline_attributes"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The data attributes used for interaction between the block and the theme editor.

The attributes are used in the theme editor's JavaScript API requests for block identification and event listening. When accessed outside the theme editor, `block.shopline_attributes` returns `nil`.
</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="type"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The type of the block.

The value is determined by the block file path and block filename. For global blocks, for example, if the file path is `blocks/block.html`, the `type` value is `block`. For private blocks, for example, if the file path is `sections/blog-demo/blocks/block.html`, the `type` value is `$block`.
</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="index0"
    types={[<Mdx>integer</Mdx>]}
>
<ObjectSummary>
The 0-based index of the current block.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="index"
    types={[<Mdx>integer</Mdx>]}
>
<ObjectSummary>
The 1-based index of the current block.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="blocks_size"
    types={[<Mdx>integer</Mdx>]}
>
<ObjectSummary>
The number of child blocks contained within the block.


</ObjectSummary>
</ObjectProperty>
        
    
    </div>


