<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Component Value Attribute in Calcite Design System Questions</title>
    <link>https://community.esri.com/t5/calcite-design-system-questions/component-value-attribute/m-p/1591817#M808</link>
    <description>&lt;P&gt;&lt;SPAN&gt;It seems that specifying a value (value=) as an attribute of a calcite component such as calcite-input or calcite-select does not make that value immediately retrievable through the calcite element's element.value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/David-Jantz/pen/QwWprgy" target="_blank" rel="noopener noreferrer"&gt;https://codepen.io/David-Jantz/pen/QwWprgy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Programmatically, in JS, you could get the calcite element's 'value attribute' via element.getAttribute("value") and subsequently assign the 'value' attribute's value to the element's value with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;element.value = element.getAttribute("value").&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;However, it's unclear why this step is necessary when components like calcite-input already contain events for updating the element.value when a user types it as an input. If a calcite component allows the developer to specify the "value=" attribute already, then what other purpose would that have than being the desired default element.value? It seems effectively no different than a placeholder.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Mar 2025 18:01:16 GMT</pubDate>
    <dc:creator>DavidJantz</dc:creator>
    <dc:date>2025-03-04T18:01:16Z</dc:date>
    <item>
      <title>Component Value Attribute</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/component-value-attribute/m-p/1591817#M808</link>
      <description>&lt;P&gt;&lt;SPAN&gt;It seems that specifying a value (value=) as an attribute of a calcite component such as calcite-input or calcite-select does not make that value immediately retrievable through the calcite element's element.value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/David-Jantz/pen/QwWprgy" target="_blank" rel="noopener noreferrer"&gt;https://codepen.io/David-Jantz/pen/QwWprgy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Programmatically, in JS, you could get the calcite element's 'value attribute' via element.getAttribute("value") and subsequently assign the 'value' attribute's value to the element's value with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;element.value = element.getAttribute("value").&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;However, it's unclear why this step is necessary when components like calcite-input already contain events for updating the element.value when a user types it as an input. If a calcite component allows the developer to specify the "value=" attribute already, then what other purpose would that have than being the desired default element.value? It seems effectively no different than a placeholder.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 18:01:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/component-value-attribute/m-p/1591817#M808</guid>
      <dc:creator>DavidJantz</dc:creator>
      <dc:date>2025-03-04T18:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Component Value Attribute</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/component-value-attribute/m-p/1592221#M809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/84980"&gt;@DavidJantz&lt;/a&gt;, this is a result of the web component lifecycle, where the components must be &lt;A href="https://developers.arcgis.com/calcite-design-system/core-concepts/#loading-components" target="_self"&gt;rendered, or ready&lt;/A&gt;&amp;nbsp;to be accessed. To access the component's property values in JavaScript, you can use the &lt;A href="https://developers.arcgis.com/calcite-design-system/core-concepts/#component-on-ready" target="_self"&gt;componentOnReady() method&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;(async () =&amp;gt; {
  await customElements.whenDefined("calcite-input");
  const inputExample = await document.getElementById("input-example").componentOnReady();
  console.log(`input value: ${inputExample.value}`);
})();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Here's a Codepen with the componentOnReady() method and event listeners for the Input and Select components:&amp;nbsp;&lt;A href="https://codepen.io/geospatialem/pen/bNGWYjm" target="_blank"&gt;https://codepen.io/geospatialem/pen/bNGWYjm&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 14:59:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/component-value-attribute/m-p/1592221#M809</guid>
      <dc:creator>KittyHurley</dc:creator>
      <dc:date>2025-03-05T14:59:40Z</dc:date>
    </item>
  </channel>
</rss>

