Files
Basalt2/docs/.vitepress/dist/assets/references_label.md.d17a67a7.js
Robert Jelic 31787b0e9b Fix
2025-02-16 18:04:24 +01:00

10 lines
6.7 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as s,o as a,c as l,Q as e}from"./chunks/framework.4313453f.js";const F=JSON.parse('{"title":"Label","description":"","frontmatter":{},"headers":[],"relativePath":"references/label.md","filePath":"references/label.md","lastUpdated":null}'),n={name:"references/label.md"},t=e(`<h1 id="label" tabindex="-1">Label <a class="header-anchor" href="#label" aria-label="Permalink to &quot;Label&quot;"></a></h1><p>Labels are non-interactive elements in Basalt used for displaying text. They are commonly used to provide descriptions, headings, or instructions within user interfaces. By default a label uses the parent background and foreground color.</p><p>Label inherit from <a href="./visualelement.html">VisualElement</a> and <a href="./element.html">BasicElement</a></p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to &quot;Properties&quot;"></a></h2><table><thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>autoSize</td><td>bool</td><td>Indicates whether the label automatically adjusts its size based on the text content.</td></tr><tr><td>text</td><td>string</td><td>The text displayed by the label.</td></tr><tr><td>wrap</td><td>boolean</td><td>Indicates whether the label text wraps to fit within its size constraints. If true, the label automatically adjusts its height to accommodate wrapped text. If false, the label adjusts its width to fit the text content without wrapping.</td></tr><tr><td>wrapUpdate</td><td>boolean</td><td>If true the label will recalculate the wrapping-phase of the text</td></tr></tbody></table><h2 id="example" tabindex="-1">Example <a class="header-anchor" href="#example" aria-label="Permalink to &quot;Example&quot;"></a></h2><div class="language-lua vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">lua</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> main </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> basalt.</span><span style="color:#79B8FF;">addFrame</span><span style="color:#E1E4E8;">()</span></span>
<span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> label1 </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">main</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">addLabel</span><span style="color:#E1E4E8;">({x</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">2</span><span style="color:#E1E4E8;">, y</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">2</span><span style="color:#E1E4E8;">})</span></span>
<span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> label2 </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">main</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">addLabel</span><span style="color:#E1E4E8;">({x</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">2</span><span style="color:#E1E4E8;">, y</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">4</span><span style="color:#E1E4E8;">, width</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">12</span><span style="color:#E1E4E8;">, wrap</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">})</span></span>
<span class="line"><span style="color:#B392F0;">label1</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">setText</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Hello World!&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#B392F0;">label2</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">setText</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Hello World!</span><span style="color:#79B8FF;">\\n</span><span style="color:#9ECBFF;">This is a test of the wrapping feature.&quot;</span><span style="color:#E1E4E8;">)</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> main </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> basalt.</span><span style="color:#005CC5;">addFrame</span><span style="color:#24292E;">()</span></span>
<span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> label1 </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">main</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">addLabel</span><span style="color:#24292E;">({x</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">2</span><span style="color:#24292E;">, y</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">2</span><span style="color:#24292E;">})</span></span>
<span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> label2 </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">main</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">addLabel</span><span style="color:#24292E;">({x</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">2</span><span style="color:#24292E;">, y</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">4</span><span style="color:#24292E;">, width</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">12</span><span style="color:#24292E;">, wrap</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">true</span><span style="color:#24292E;">})</span></span>
<span class="line"><span style="color:#6F42C1;">label1</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">setText</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Hello World!&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#6F42C1;">label2</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">setText</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Hello World!</span><span style="color:#005CC5;">\\n</span><span style="color:#032F62;">This is a test of the wrapping feature.&quot;</span><span style="color:#24292E;">)</span></span></code></pre></div>`,7),o=[t];function p(r,c,y,i,d,E){return a(),l("div",null,o)}const b=s(n,[["render",p]]);export{F as __pageData,b as default};