How to use the lit-html/directives/if-defined.ifDefined function in lit-html

To help you get started, we’ve selected a few lit-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github carbon-design-system / carbon-custom-elements / tests / spec / textarea_spec.ts View on Github external
readonly?: boolean;
  required?: boolean;
  validityMessage?: string;
  value?: string;
} = {}) => {
  const inner = !hasContent
    ? (undefined! as TemplateResult)
    : html`
        
      `;
  return !hasContent || !hasForm
    ? inner
    : html`
        <form>${inner}</form>
      `;
};
github carbon-design-system / carbon-custom-elements / tests / spec / slider_spec.ts View on Github external
hasForm?: boolean;
  disabled?: boolean;
  labelText?: string;
  max?: number;
  min?: number;
  name?: string;
  step?: number;
  value?: number;
} = {}) =&gt; {
  const inner = !hasContent
    ? (undefined! as TemplateResult)
    : html`
        
      `;
  return !hasContent || !hasForm
    ? inner
    : html`
        <form>${inner}</form>
      `;
};
github carbon-design-system / carbon-custom-elements / tests / spec / toggle_spec.ts View on Github external
checkedText?: string;
  disabled?: boolean;
  id?: string;
  labelText?: string;
  name?: string;
  value?: string;
  uncheckedText?: string;
} = {}) =&gt; {
  const inner = !hasContent
    ? (undefined! as TemplateResult)
    : html`
        
      `;
  return !hasContent || !hasForm
    ? inner
    : html`
        <form>${inner}</form>
      `;
};
github carbon-design-system / carbon-custom-elements / tests / spec / button_spec.ts View on Github external
type?: string;
} = {}) =&gt;
  !hasContent
    ? (undefined! as TemplateResult)
    : html`
        
      `;
github carbon-design-system / carbon-custom-elements / tests / spec / toggle_spec.ts View on Github external
disabled?: boolean;
  id?: string;
  labelText?: string;
  name?: string;
  value?: string;
  uncheckedText?: string;
} = {}) =&gt; {
  const inner = !hasContent
    ? (undefined! as TemplateResult)
    : html`
        
      `;
  return !hasContent || !hasForm
    ? inner
    : html`
        <form>${inner}</form>
      `;
};
github nik-christou / lit-element-bootstrap / components / form / bs-form.js View on Github external
render() {
        return html`
            <form action="${ifDefined(this.action)}" name="${ifDefined(this.name)}">
                
            </form>
        `;
    }
github carbon-design-system / carbon-custom-elements / src / components / data-table / data-table-story.ts View on Github external
({ id: columnId, sortCycle, title }) =&gt; {
                const sortDirectionForThisCell =
                  sortCycle &amp;&amp; (columnId === sortColumnId ? sortDirection : TABLE_SORT_DIRECTION.NONE);
                return html`
                  
                    ${title}
                  
                `;
              }
            )}
github sinnerschrader / feature-hub / packages / dom / src / feature-app-loader.ts View on Github external
private async loadFeatureApp(): Promise {
      try {
        if (!this.src) {
          throw new Error('No src provided.');
        }

        const definition = await featureAppManager.getAsyncFeatureAppDefinition(
          prependBaseUrl(this.baseUrl, this.src)
        ).promise;

        return html`
          
            
          
        `;
      } catch (error) {
        logger.error(error);

        return html`
          
        `;
      }
    }
  }
github runem / lit-analyzer / dev / src / my-app.ts View on Github external
const myApp = (text: string, disabled: boolean) =&gt; html`
	<img src="${ifDefined(src)}">

	<style>
		my-button {
			color: ${"green"};
		}

		a {
			color: rebeccapurple;
			additive-symbols: cross-fade();
		}
	</style>

	

	<a download="hello"></a>