LayoutHub
  • What is LayoutHub?
  • User guides
    • Support
    • Installation
    • Uninstallation
    • Upgrade/Downgrade
    • FAQs
      • How to remove instagram section from Layouthub
      • What is "Pages limit"?
      • When can I "Edit code"?
      • What about "Save section"?
      • What is " Auto save draft"?
      • What is "Integration Services"?
      • How to set the same font between Shopify and LayoutHub?
      • How to custom font and color on LayoutHub?
      • How to set "Page handle or human url"?
      • Connective Button
      • How to save page without publish it
      • How to change the meta SEO for LayoutHub's page
    • Common Issues
    • Layout Management
      • Create Layouts
      • Design Blocks
      • Export & Import
      • Edit Section Code
      • Edit a Layout
      • Assign a Layout
      • Duplicate a Layout
      • Delete a Layout
    • Section builder
    • LayoutHub pages/templates
      • Home Page
        • Create additional Home Page
        • Make an existing page as home page
        • Restore to default Home Page
        • Customize Shopify Home Page
      • Sub-page
        • Contact Form
      • Product Template
        • Product Detail
        • Related Product
      • Collection Template
      • Blog Templates
      • Article Templates
      • Insert section
    • Pricing Plans
    • Settings
      • General
      • Theme Settings
      • Quickview Settings
      • Swatch color settings
      • Third party Apps
        • Product Review
        • Product Wishlist
    • Trash
    • Sale Tools
    • Referrals
    • Integration
      • Add/Edit Profile
      • Add New Contact
      • Export Contact
      • Mailchimp
      • Hubspot
      • ActiveCampaign
      • GetResponse
      • SendGrid
      • Gmail SMTP
      • Google Sheets
      • Omnisend
      • Klaviyo
      • ConvertKit
    • Tracking & Analytics
    • Layouthub & Shopify
    • Translate Apps
    • Recommend apps
      • Avada SEO Optimization
      • Ali Reviews ‑ Product Reviews
      • Ryviu: Product Reviews App UGC
      • Quick View by Secomapp
      • LAI AliExpress Reviews
      • Judge.me Product Reviews
      • Growave - Loyalty, Wishlist, Reviews UGC
      • Opinew Product Reviews
    • Refund Policy
    • Instagram token
  • Development
    • Getting started
    • Tools
      • LayoutHub Kit (for LayoutHub developers only)
      • LayoutHub Kit Extension for Visual Studio Code
    • Layout Structure
    • Reference
      • Engine syntax
        • Deprecated: March 2020
        • Chuẩn template mới - LayoutHub Editor V4
      • Create a section
      • Components
      • Liquid in section
      • Javascript in section
      • Register vendors
      • Settings.js
        • Call-to-action
        • Text
        • Textarea
        • Text Editor
        • Dropdown
        • Checkbox list
        • Checkbox radio
        • Toggle
        • Number slider
        • Number
        • Single image
        • Image library
        • Color picker
        • Icon picker
        • Font picker
        • Background
        • Picker
        • Group fields
Powered by GitBook
On this page

Was this helpful?

  1. Development
  2. Reference

Create a section

PreviousChuẩn template mới - LayoutHub Editor V4NextComponents

Last updated 3 years ago

Was this helpful?

You can create sections in the developer directory or inside a layout. Start by creating a folder with the following structure:

The folder structure of section.

  1. Asset folder: includes section resource like images

  2. Components folders: includes the components of section

  3. liquid.json embed liquid to template

  4. Section.lh: Includes schema and code of this section

  5. Settings.js Settings for section

  6. Style.css: Stylesheet file of this section

  7. Thumbnail file

@schema
{
    "name": "Product single",
    "author": "Layouthub Team",
    "website": "https://www.layouthub.com",
    "version": "2.0",
    "category": "Product single",
    "platform": "shopify",
    "vendors": ["js_swiper_slider","css_layouthub_base"],
    "dev": "LayoutHub core team"
} 
@endschema 

<div class="lh-wrapper">	
		<p class="lh-color-red">
			The setting value: <span v-html="settings.one"></span>
		<p>
		<p v-html="combined"></p> 
		<MyComponent />
		<button class="lh-button"><button>
</div>

@javascript
	let $this = jQuery(this);
	$this.find('.lh-button').click(function(e){
		e.preventDefault();
		$this.find('.lh-color-red').toggle();//Show hide a element
	});
@endjavascript


<script>
export default {
	data:{
		
		},
	computed: {
		combined () {
			return `${this.settings.one} - ${this.settings.two}`;
		}
	},
	methods: {
		callme(item) {
			return 'item name: '+item.name;
		}
	}
}
@endr
</script>
<style lang="scss">

	.lh-color-red{
		color:red;
	}
	
</style>
[
    {
        tab_name:"General",
        settings:[
            {
                name: 'one',
                label: 'The first setting',
                type: 'text',
                value: 'The default value'
            },
             {
                name: 'two',
                label: 'The second setting',
                type: 'text',
                value: 'The default value 2'
            },
            {
                name: 'name',
                label: 'The text',
                type: 'text',
                value: 'Hello Component'
            }
        ]
    }
]
<template>
<div>
<h3> The component is: </h3>
<p v-html="settings.name"></p>
</div>
</template>

If you love LayoutHub, could you consider posting an review? That would be awesome and really help us to grow our business, here is the.

link