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

react-scrycards

v1.7.0

Published

This library provides react components for rendering cards with data from [Scryfall API](https://scryfall.com/docs/api).

Downloads

83

Readme

React Scrycards

This library provides react components for rendering cards with data from Scryfall API.

This project is unaffiliated with Scryfall

Installation

npm install react-scrycards

Importing CSS

import "react-scrycards/dist/index.css";

Examples

Base Use Case

Context

import { ScrycardsContextProvider } from "react-scrycards";

<ScrycardsContextProvider>
    <Root />
</ScrycardsContextProvider>

This context provides a function to fetch a card asyncronously. If the card doesn't exist in the cache, the card is fetched from Scryfall. This context is optimized for high volume renders; requests are batched on each render cycle so a page which renders 50 new cards will only make 1 fetch request.

requestCard(arg0:string)

The other function provided by the context allows prefetching of cards. This is great for scenarios where the cardpool is known beforehand but cards may be rendered over time (such as in a simulator). By prefetching, you only fetch once instead of each time a new card is rendered.

preloadCards(arg0:string[])

ScryNameCard

import { ScrycardsContextProvider, ScryNameCard } from "react-scrycards";

<ScryNameCard card_name="Opt">

Rendering and fetching a card is as simple as using the <ScryNameCard/> inside the context. <ScryNameCard/> wraps <Scrycard/> to provide a card object from a name or id using the Scrycards Context.

All Scrycard card components have several props to control how the rendered card looks. Try using "animated" for a tasteful hover animation, or "flipable" to automatically handle multifaced or multisided cards.

Custom Use Case

import { Scrycard, Scrytext, IScrytextProps } from "react-scrycards";
import ScryfallCard from "@scryfall/api-types"


function CustomScrytext(props: IScrytextProps) {
    const { symbols } = useSymbolsFromCustomContext()
    return <Scrytext {...props} symbols={symbols}/>
}

function CustomScrycard(props:{card: ScryfallCard.ANY}) {
    return <ScryCard card={props.card} symbol_text_renderer={CustomScrytext}/>
}

Scrycard

While the context is great for providing a link between card names and card ids to their Scryfall objects, an application may want to take advantage of the components without the context.

<Scrycard card={card}/> renders a card:ScryfallCard.ANY object without using the context.

Scrytext

Rendering Scrycards outside the context works great except when using the textOnly prop. Because, <Scrycard/> doesn't have a map for {?} strings to their symbols unless it is fetched.

<Scrycard/> accepts a symbol_text_renderer() (such as <Scrytext/>) to parse text with {?} strings and replace with the corresponding symbols. This renderer is used for the oracle text and mana cost for textOnly layout.

<Scrytext symbols={symbols}/> accepts a IScrysymbolMap to match strings like "{R}" to their corresponding symbol uris.

<ScryNameCardText/> is also an option that wraps <Scrytext/> to provide a symbol renderer that pulls symbols from the context.