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

@zikojs/preact-console

v0.5.0

Published

Console components for Preact applications.

Readme

@zikojs/preact-console

A console-like UI component for Preact that renders JavaScript console output directly inside your application.

'Preact console'

@zikojs/preact-console provides JSX components that mimic common browser console methods such as console.log(), console.warn(), and console.table() while rendering the output as part of the Preact UI.

✨ Features

  • 🖥️ Console-like output rendered directly in the DOM
  • ⚛️ Designed for Preact and JSX
  • 🔍 Supports JavaScript objects and arrays
  • 📋 Table-style rendering for structured data
  • ⚠️ Dedicated warning output
  • 🧩 Component-based API
  • 🎨 Can be styled with CSS
  • 🪶 Lightweight and focused
  • 🔌 Useful for notebooks, playgrounds, documentation, and developer tools

📦 Installation

npm install @zikojs/preact-console

Or with pnpm:

pnpm add @zikojs/preact-console

🚀 Usage

Import Console and use its methods as JSX components:

import { render } from 'preact'
import { Console } from '@zikojs/preact-console'

render(
  <>
    <Console.log>
      {['Item 1', 'Item 2']}
    </Console.log>

    <Console.table>
      {['Item 1', 'Item 2']}
    </Console.table>

    <Console.warn>
      {{ window }}
    </Console.warn>
  </>,
  document.getElementById('app')
)

📝 Console Methods

Console.log

Renders standard console output.

<Console.log>
  {'Hello World'}
</Console.log>

It can also render arrays:

<Console.log>
  {[1, 2, 3, 4]}
</Console.log>

Or objects:

<Console.log>
  {{
    name: 'ZikoJS',
    version: '2.0.0',
    type: 'library'
  }}
</Console.log>

Console.warn

Renders warning-style console output.

<Console.warn>
  {'This is a warning'}
</Console.warn>

Objects can be inspected as well:

<Console.warn>
  {{ window }}
</Console.warn>

Console.table

Renders data using a table-oriented representation.

<Console.table>
  {[
    ['Item 1', 10],
    ['Item 2', 20],
    ['Item 3', 30]
  ]}
</Console.table>

Objects can also be passed:

<Console.table>
  {[
    { name: 'Item 1', value: 10 },
    { name: 'Item 2', value: 20 },
    { name: 'Item 3', value: 30 }
  ]}
</Console.table>

🔍 Inspecting Objects

@zikojs/preact-console is designed to display JavaScript values in a console-like format rather than simply converting them to strings.

For example:

<Console.log>
  {{
    user: {
      name: 'John',
      age: 25
    },
    items: [1, 2, 3]
  }}
</Console.log>

This makes the component useful for displaying complex runtime values in interactive applications.

🧩 Using Multiple Console Outputs

Console components can be combined naturally:

import { render } from 'preact'
import { Console } from '@zikojs/preact-console'

function App() {
  return (
    <div>
      <Console.log>
        {'Application started'}
      </Console.log>

      <Console.log>
        {[1, 2, 3]}
      </Console.log>

      <Console.warn>
        {'Something may require your attention'}
      </Console.warn>

      <Console.table>
        {[
          { name: 'Alice', score: 95 },
          { name: 'Bob', score: 87 }
        ]}
      </Console.table>
    </div>
  )
}

render(<App />, document.getElementById('app'))

🧪 Playground / Notebook Usage

The component is particularly useful for interactive environments such as:

  • JavaScript playgrounds
  • Code editors
  • Notebooks
  • Documentation websites
  • REPLs
  • Educational applications
  • Developer tools
  • Component demos

For example, a notebook can render the result of:

console.log(value)

as a component inside the notebook output area instead of writing to the browser's DevTools console.

🔗 ZikoJS Ecosystem

@zikojs/preact-console is part of the broader ZikoJS ecosystem, which provides UI primitives, framework integrations, developer tools, and other web development utilities.

Related packages include:

  • ziko : ZikoJS core
  • @zikojs/preact : ZikoJS ↔ Preact integration
  • @zikojs/console : framework-independent ZikoJS

ZikoJS itself is organized as a modular ecosystem with integrations for multiple UI frameworks.

📄 License

MIT