npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flex-render

v1.0.0

Published

Utility to render LINE Flex Bubble / Carousel JSON for displaying in website.

Readme

flex-render

Core framework-agnostic rendering engine for LINE Flex Messages (Bubbles & Carousels).

npm version License: MIT

flex-render takes raw Flex Message JSON specifications exported from the LINE Flex Message Simulator or generated via @line/bot-sdk and parses them into pixel-accurate HTML strings with accompanying CSS styles.


📦 Installation

# pnpm
pnpm add flex-render

# npm
npm install flex-render

# yarn
yarn add flex-render

# bun
bun add flex-render

🚀 Usage

Import the render function from flex-render and the stylesheet flex-render/css:

import { render } from 'flex-render'
import 'flex-render/css'

const flexJSON = {
  type: 'bubble',
  hero: {
    type: 'image',
    url: 'https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png',
    size: 'full',
    aspectRatio: '20:13',
    aspectMode: 'cover',
  },
  body: {
    type: 'box',
    layout: 'vertical',
    contents: [
      {
        type: 'text',
        text: 'Brown Cafe',
        weight: 'bold',
        size: 'xl',
      },
      {
        type: 'text',
        text: 'Tokyo, Japan',
        size: 'sm',
        color: '#aaaaaa',
      },
    ],
  },
}

// Generates HTML markup string
const htmlString = render(flexJSON)

// Inject into HTML DOM element
document.getElementById('flex-container')!.innerHTML = htmlString

Note: Don't forget to import import 'flex-render/css' in your entry file so all Flex Message styling (flexbox layouts, fonts, bubbles, carousels, action links) renders correctly.


📚 API Reference

render(flexJSON: FlexContainer): string

Renders a LINE Flex Container (FlexBubble or FlexCarousel) into an HTML string ready for DOM insertion.

Parameters:

  • flexJSON: A valid LINE Flex Container object conforming to the LINE Messaging API Flex Message spec (Bubble or Carousel).

Returns:

  • string: Complete HTML representation wrapped in a .flex-preview container element.

🧩 Exported Types

flex-render exports TypeScript definitions for all LINE Flex Message structures:

import type {
  FlexContainer,
  FlexBubble,
  FlexCarousel,
  FlexBox,
  FlexButton,
  FlexImage,
  FlexIcon,
  FlexText,
  FlexSpan,
  FlexSeparator,
  FlexFiller,
  FlexSpacer,
  FlexVideo,
} from 'flex-render'

🖼️ Framework Integration

If you are using React or Vue, official component wrappers are available:

For demo applications, check out the apps/ folder in the GitHub repository.


🐛 Bug Reports

If you encounter any issues or rendering discrepancies, please report them on our GitHub Issue Tracker.


📄 License

MIT © Supakarn Laorattanakul (iamprompt)