How to use the @stencil/core.Component function in @stencil/core

To help you get started, we’ve selected a few @stencil/core 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 ionic-team / stencil / test / karma / test-app / dynamic-css-variables / cmp.tsx View on Github external
import { Component, State, h } from '@stencil/core';

@Component({
  tag: 'dynamic-css-variable',
  styleUrl: 'cmp.css'
})
export class DynamicCssVariables {

  @State() bgColor = 'white';

  getBackgroundStyle() {
    return this.bgColor && this.bgColor !== 'white' ? { 'background': this.bgColor, '--font-color': 'white' } : {};
  }

  changeColor() {
    if (this.bgColor === 'white') {
      this.bgColor = 'red';
    } else {
      this.bgColor = 'white';
github aws-amplify / amplify-js / packages / amplify-ui / src / components / amplify-examples / rock-paper-scissor / rock-paper-scissor.tsx View on Github external
{
    icon: '👋',
    label: 'paper',
  },
  {
    icon: '👊',
    label: 'rock',
  },
];

function getRandomIcon() {
  const index = Math.floor(Math.random() * Math.floor(icons.length));
  return icons[index];
}

@Component({
  tag: 'rock-paper-scissor',
  styleUrl: 'rock-paper-scissor.css',
})
export class RockPaperScissor {
  @Element() el: HTMLElement;

  @Prop() icon: Function;

  @State() currentIcon: Icon = getRandomIcon();
  @Event() change: EventEmitter;

  @Watch('currentIcon')
  watchCurrentIcon(currentIcon) {
    this.change.emit(currentIcon);
  }
github Esri / calcite-components / src / components / calcite-date-range / calcite-date-range.tsx View on Github external
import {
  Component,
  Element,
  h,
  Host,
  Build,
  Watch,
  Prop
} from "@stencil/core";

@Component({
  tag: "calcite-date-range",
  styleUrl: "calcite-date-range.scss",
  shadow: true
})
export class CalciteDateRange {
  @Element() el: HTMLElement;
  @Prop() start: any;
  @Prop() end: any;
  @Prop() expandDateRange: boolean = false;
  startDate: any;
  endDate: any;
  min: any;
  max: any;

  private startObserver: MutationObserver;
  private endObserver: MutationObserver;
github bfmatei / stencil-boilerplate / src / components / shared / app-button / app-button.tsx View on Github external
import {
  Component,
  Listen,
  Prop
} from '@stencil/core';

import noop from '../../../helpers/noop';

@Component({
  tag: 'app-button',
  styleUrl: 'app-button.pcss'
})
export class AppButton {
  @Prop()
  public label: string = '';

  @Prop()
  public icon: string = '';

  @Prop()
  public onClick: (evt: UIEvent) => void = noop;

  @Prop()
  public disabled: boolean = false;
github ionic-team / ionic / core / src / components / slides / slides.tsx View on Github external
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, Watch, h } from '@stencil/core';

import { getIonMode } from '../../global/ionic-global';

import { SwiperInterface, SwiperOptions } from './swiper/swiper-interface';

/**
 * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
 */
@Component({
  tag: 'ion-slides',
  styleUrls: {
    ios: 'slides.ios.scss',
    md: 'slides.md.scss'
  },
  assetsDir: 'swiper',
})
export class Slides implements ComponentInterface {

  private scrollbarEl?: HTMLElement;
  private paginationEl?: HTMLElement;
  private swiperReady = false;
  private mutationO?: MutationObserver;
  private readySwiper!: (swiper: SwiperInterface) => void;
  private swiper: Promise = new Promise(resolve => { this.readySwiper = resolve; });
github manifoldco / ui / src / components / manifold-forward-slot / manifold-forward-slot.tsx View on Github external
import { Component } from '@stencil/core';
import logger from '../../utils/logger';
import loadMark from '../../utils/loadMark';

@Component({
  tag: 'manifold-forward-slot',
})
export class ManifoldForwardSlot {
  @loadMark()
  componentWillLoad() {}

  @logger()
  render() {
    return null;
  }
}
github BlazeSoftware / blaze / packages / site / src / components / components / components-toasts.tsx View on Github external
import { h, Component, Prop } from '@stencil/core';

@Component({
  tag: 'components-toasts',
})
export class ComponentsToasts {
  @Prop()
  name: string;

  render() {
    return (
      
        <p class="c-paragraph">
          Toasts or growls are covered by special modifiers on{' '}
          Alerts and usually appear in one of the
          corners of your page to draw your attention to something that has happened.
        </p>
github ionic-team / stencil-site / src / components / resources-page / resources-page.tsx View on Github external
import { Component, h } from '@stencil/core';

@Component({
  tag: 'resources-page',
  styleUrl: 'resources-page.css'
})
export class ResourcesPage {

  constructor() {
    document.title = `Stencil Resources`;
  }

  render() {
    return [
      <div class="container">
        <h1 class="headline measure-md">Resources to help you get more out of Stencil</h1>

        <section class="measure-lg">
          <h2>Community Articles/Blogs</h2></section></div>
github BlazeSoftware / blaze / packages / site / src / components / objects / objects-modals.tsx View on Github external
import { h, Component, Prop } from '@stencil/core';

@Component({
  tag: 'objects-modals',
})
export class ObjectsModals {
  @Prop()
  name: string;

  render() {
    return (
      
        
  
    
      <h2 class="c-heading u-xlarge"></h2>
github orbital-js / orbital-old-framework / docs / src / components / documentation / getting-started / getting-started.tsx View on Github external
import { Component } from '@stencil/core';

@Component({
  tag: 'getting-started',
  styleUrl: 'getting-started.scss'
})
export class GettingStarted {

  render() {
    return [
      
    ]
  }
}