# @krofdrakula/prop-docs-preact

> A tool to extract prop types from Preact components

Latest version **0.0.9** (published 2023-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @krofdrakula/prop-docs-preact
pnpm add @krofdrakula/prop-docs-preact
yarn add @krofdrakula/prop-docs-preact
bun add @krofdrakula/prop-docs-preact
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2023-02-16 |
| First published | 2023-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Klemen Slavič |
| Maintainers | krofdrakula |
| Keywords | typescript, types, proptypes, storybook |

## Links

- npm: https://www.npmjs.com/package/@krofdrakula/prop-docs-preact
- Repository: https://github.com/KrofDrakula/prop-docs
- Homepage: https://github.com/KrofDrakula/prop-docs#readme
- Issues: https://github.com/KrofDrakula/prop-docs/issues
- npm.io page: https://npm.io/package/@krofdrakula/prop-docs-preact

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2023-02-16
- 0.0.8 — 2023-02-16
- 0.0.7 — 2023-02-16
- 0.0.6 — 2023-02-13
- 0.0.5 — 2023-02-09
- 0.0.4 — 2023-02-06
- 0.0.3 — 2023-02-06
- 0.0.2 — 2023-01-17
- 0.0.1 — 2023-01-17

## README

This package is part of the `@krofdrakula/prop-docs-*` ecosystem. Please visit
the monorepository for a complete walkthrough:

https://github.com/krofdrakula/prop-docs

<!--#content-->

## Preact

Install the `preact` package:

```
yarn add @krofdrakula/prop-docs-preact
```

Here's an example component file (`components.tsx`):

```ts
interface BadgeProps {
  /** Name of person */
  name: string;
  /** Notification count */
  count: number;
}

export const Badge: FunctionalComponent<BadgeProps> = ({ name, count }) => {
  return (
    <div>
      {name} ({count})
    </div>
  );
};

interface ProfileProps {
  /** Person's image URL */
  image: string;
  /** Person's name */
  name: string;
}

export class Profile extends Component<ProfileProps> {
  render() {
    const { image, name } = this.props;
    return <img src={image} title={name} />;
  }
}
```

To use the package, you'll need to instantiate the `Project` class and configure
it for your code base:

```ts
import { Project } from "ts-morph";
import { extractComponents } from "@krofdrakula/prop-docs-preact";

const project = new Project({
  // Configure your tsconfig.json path and other options.
  // You can opt to explicitly add your own source files instead and configure
  // `compilerOptions` here if needed.
});

const { Badge, Profile } = extractComponents(project, "components.tsx");
//             ^? { image: string; name: string; }
//      ^? { name: string; count: number; }
```

The return types are instances of [`Type`](https://ts-morph.com/details/types)
which provides the description of the props object.

<!--#/content-->

---
_Source: https://npm.io/package/@krofdrakula/prop-docs-preact · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
