Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LitElement Dot with HTML elements attribute/property

I am learning web components using Polymer. I am a beginner in web development.

How can I understand what does dot notation means in .checked attributes or property of HTML element?

<input id="state" type="radio" name=${this.group} .checked=${this.checked} />
like image 359
user2914606 Avatar asked Jul 23 '26 04:07

user2914606


1 Answers

Overall the binding type consists of these character prefixes: .prop, ?optional and @event.

html`<input 
    id="state" 
    type="radio" 
    name=${this.group} 
    @change=${onChange}
    ?required=${required}
    .checked=${this.checked} />`

You can insert JavaScript expressions as placeholders for HTML text content, attributes, Boolean attributes, properties, and event handlers.

  • Text content: <p>${...}</p>
  • Attribute: <p id="${...}"></p>
  • Boolean attribute: ?disabled="${...}"
  • Property: .value="${...}"
  • Event handler: @event="${...}"

lit-element documentation

Live Demo

like image 134
Penny Liu Avatar answered Jul 24 '26 16:07

Penny Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!