css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <button>Hover for a new image</button>
              html, body {
  min-height: 400px;

button {
  background: #ddd;
  border: none;
  font-size: 20px;
  padding: 10px 20px;

.tippy-tooltip.ajax-theme {
  position: absolute;
  width: 200px;
  padding: 0;
  overflow: hidden;

.tippy-tooltip.ajax-theme img {
  display: block;
  max-width: 100%;

We need to "pin" the tooltip absolutely to the bottom or top of the popper element depending on the placement. Note: this overrides the `distance` option. You can change `0` to be whatever you want. 
.tippy-tooltip.ajax-theme[x-placement^='top'] {
  top: auto !important;
  bottom: 0;

.tippy-tooltip.ajax-theme[x-placement^='bottom'] {
  bottom: auto !important;
  top: 0;
              const INITIAL_CONTENT = '<div style="margin:5px 0;">Loading...</div>'

tippy('button', {
  animation: 'fade',
  animateFill: false,
  theme: 'ajax',
  onShow(tip) {
    if (tip.state.isFetching === true || tip.state.canFetch === false) {

    tip.state.isFetching = true
    tip.state.canFetch = false

    const { popper } = tip
    const { tooltip, content } = tip.popperChildren

    // Because the tooltip has `position: absolute`,
    // it no longer affects the parent popper's layout.
    // We need to explicitly give it a width.
    popper.style.width = '200px'
    // Setup transition styles
    tooltip.style.transitionDuration = '0.2s'
    tooltip.style.transitionProperty = 'visibility, opacity, height'

      .then(response => response.blob())
      .then(blob => {
        tip.state.isFetching = false

        const url = URL.createObjectURL(blob)

        if (!tip.state.isVisible) {

        const img = new Image()
        img.width = 200
        img.height = 200
        img.src = url

        // Wait until the height transition has finished before
        // fading the content in. Since we have `overflow: hidden`
        // on the tooltip this isn't actually needed, but if you
        // have an arrow element it will be.
        if (!tip._transitionEndListener) {
          tip._transitionEndListener = event => {
            if (event.target === event.currentTarget) {
              content.style.opacity = '1'
        tooltip.addEventListener('transitionend', tip._transitionEndListener)

        // Store the base height of the tooltip when it has the
        // initial Loading... content.
        if (!tip._baseHeight) {
          tip._baseHeight = tooltip.clientHeight

        // Here is where we find out the height of the tooltip
        // when it has the content. We could technically hardcode
        // 200px as the value, but it's useful to know how to do
        // this with dynamic content.
        content.style.opacity = '0'
        // Temporarily set the image as the tooltip's content
        // so we can find out the final height of the tooltip.
        const height = tooltip.clientHeight
        // Apply the height to the parent popper element.
        popper.style.height = height + 'px'
        // Reset the tooltip's height to the base height.
        tooltip.style.height = tip._baseHeight + 'px'
        // Cause reflow so we can start the height transition.
        void tooltip.offsetHeight
        // Start the transition.
        tooltip.style.height = height + 'px'
        // Remove the Loading... content and wait until the
        // transition finishes.
      .catch(() => {
        tip.state.isFetching = false
  onHidden(tip) {
    tip.state.canFetch = true
    const { tooltip } = tip.popperChildren
    tooltip.style.height = null
    tooltip.removeEventListener('transitionend', tip._transitionEndListener)
    tip._transitionEndListener = null

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................