Latitude ComponentsLibrary 0.1.0

Ghost input

Text that reads as plain text until you point at it, for inline edits such as titles. It has no border or fill at rest. Use <lat-input> instead when the field needs a label and should look like a form. Rules: UX Elements & Rules → GhostInput.

Add it to a page

Load the pinned file once in your Latitude Site or web page, then use the tag.

<script type="module" src="https://web-components.sites.latd.com/components/lat-ghost-input/0.1.0/lat-ghost-input.js"></script>

The file is an ES module. It loads Lit, the design-system tokens and the Roobert stylesheet from this catalog once per page, however many components you use.

Version0.1.0
File/components/lat-ghost-input/0.1.0/lat-ghost-input.js (2.0 KB gzipped)
SHA-25642116a134f41d17b857307ccaded9fae1c36e9d6a76fa48d062f35d9da6982b0

Permutations

Regular and medium

Dark
Light
<div style="width: 240px">
  <lat-ghost-input label="Study title" value="Q3 brand lift"></lat-ghost-input>
</div>
<div style="width: 240px">
  <lat-ghost-input label="Study title" size="medium" value="Q3 brand lift"></lat-ghost-input>
</div>

Empty

Dark
Light
<div style="width: 240px">
  <lat-ghost-input label="Clip title" placeholder="Add a title"></lat-ghost-input>
</div>

Aligned right

Dark
Light
<div style="width: 240px">
  <lat-ghost-input label="Clip title" align="right" value="Opening scene"></lat-ghost-input>
</div>

With reset

Dark
Light
<div style="width: 240px">
  <lat-ghost-input label="Clip title" clearable value="Opening scene"></lat-ghost-input>
</div>

Readonly and disabled

Dark
Light
<div style="width: 240px">
  <lat-ghost-input label="Study title" readonly value="Q3 brand lift"></lat-ghost-input>
</div>
<div style="width: 240px">
  <lat-ghost-input label="Study title" disabled value="Q3 brand lift"></lat-ghost-input>
</div>

In a form

Dark
Save
Light
Save
<form
  style="display: flex; flex-wrap: wrap; align-items: center; gap: 16px"
  onsubmit="event.preventDefault();
    this.querySelector('output').value = 'Saved'">
  <div style="width: 240px">
    <lat-ghost-input label="Study title" name="title" required
      value="Q3 brand lift"></lat-ghost-input>
  </div>
  <lat-button variant="primary" size="sm" type="submit">Save</lat-button>
  <output></output>
</form>

Editing

Enter or leaving the field commits the edit and fires change, if the text changed. Escape puts back the text from before the edit. Enter never submits a surrounding form.

Attributes

AttributeValuesNotes
labeltextRequired. The field's name for screen readers; nothing is shown.
valuetextThe initial text. The value property holds the current one; resetting the form puts this back.
placeholdertextShown when empty, such as “Add a title”.
nametextSubmitted with the form.
sizeregular (default, 24px), medium (28px)
alignleft (default), right
clearablebooleanThe spec's Reset: a clear (×) button after the text, shown on hover or keyboard focus.
requiredbooleanAn empty edit is put back instead of committed.
readonlybooleanNo hover fill; the text can be selected but not changed.
disabledboolean

Events

EventNotes
inputOn every keystroke.
changeWhen an edit is committed with new text, or the text is cleared.