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

@salla.sa/twilight-components-react

v3.0.0-beta.1

Published

React wrapper for Salla Twilight Web Components

Maintainers

ali-subaieali-subaiekamalmirzayevkamalmirzayevabady009abady009fares.dfares.dm.ayarim.ayarii.bakhsh4sallai.bakhsh4sallaajibadeabdajibadeabdjamallajamallaowieselshaikhowieselshaikhwatheq_alshowaiter_sallawatheq_alshowaiter_sallamaqalaqilmaqalaqilibra-hassanibra-hassananass_atanass_atsalahmynsalahmynanasredanasredadelgsadelgsdev-tarekdev-tarekshamoon1997shamoon1997mohammed_ashraafmohammed_ashraafhassankottihassankottimazizsallamazizsallacanarydev41canarydev41odaigawbraodaigawbraiabdallahiabdallahahmed4324345ahmed4324345ali-mhdali-mhdossycodesossycodesm.farhan.sallam.farhan.sallas.alkhwlanis.alkhwlaninikhilpawar30nikhilpawar30tahasallatahasallaegkrinkelegkrinkelomersamliomersamliahmed-elazizahmed-elazizmzfrshkmzfrshkghofranesallaghofranesallaabdulrahman_sallaabdulrahman_sallanaderm91naderm91arshad1024arshad1024abubakermoharramabubakermoharrama.qahtana.qahtanahmed-amlasahmed-amlasnullish-onenullish-onethaifanithaifanisoao_dsoao_ddhaferdhaferadel.elshafeyadel.elshafeymalshoubakimalshoubakimohanad7afizmohanad7afizrashaamer87rashaamer87ahmed-alkatheriahmed-alkatherihossamelsawyhossamelsawydhassanalidhassanaliabdulrazzak-almohamadabdulrazzak-almohamada-athamneh-sallaa-athamneh-sallaalkhatera-sallaalkhatera-sallaoalachioalachim.emam.sallam.emam.sallaa.djedainia.djedainimhd-mazenmhd-mazenzafari8zafari8kulth00mkulth00mmuhammed-shmuhammed-shahmed-elnaggarahmed-elnaggaraminealyateaminealyateahmed3mmarahmed3mmarashraf.redaashraf.redadevlomingodevlomingoelzakzoukelzakzoukaliarsalan177aliarsalan177hamzasallahamzasallamostafaezzeldinmostafaezzeldinjojomak13jojomak13dev_foudadev_foudayalattas-sallayalattas-sallabuhoribuhorimohammad-altamimimohammad-altamimimaher-sallamaher-sallailyasabdul94ilyasabdul94iahmadzainiahmadzainhanisaeedhanisaeedhazemsallahazemsallaosameyyosameyyabdulrhman_kassemabdulrhman_kassemeslammooeslammoomajedsallamajedsallamntahhan_sallamntahhan_sallahalsairihalsairiwael_bettayebwael_bettayebimutaharimutaharyassine87yassine87yasser.syasser.smostafanabawymostafanabawyaboubakar.devaboubakar.devawajieh-sallaawajieh-sallasayed-159sayed-159m.alfaifim.alfaifiaeldalysaeldalysm.hammad10m.hammad10z.hamanez.hamanefarah-slfarah-slsirsayed98sirsayed98mozedan-sallamozedan-sallaabdelrahman-sallaabdelrahman-sallamfkfawazmfkfawazalquhaitsallaalquhaitsallaabbasshdevabbasshdevalialjishialialjishiochanii-sallaochanii-sallamomen-mahmoud-mahmoudmomen-mahmoud-mahmoudmurkbhuttomurkbhuttoaliahmed-sallaaliahmed-sallasagark45sagark45houssem-amrihoussem-amriahmednabilahmednabilmaher-gadmaher-gadsoaodsoaodtamir-sallatamir-sallaattia_sallaattia_sallarefal_alharbirefal_alharbinabeel-sallanabeel-sallajalmatarijalmatariusama-sallausama-sallaabdulmajidashraf81abdulmajidashraf81m-shaeelm-shaeelibrahimkubaisyibrahimkubaisyhalwany_sallahalwany_sallaaladdin-sallaaladdin-sallafaisal-alhusfaisal-alhusa.almomania.almomaniemanlowndiemanlowndiwaleed.sallawaleed.sallahamedov93hamedov93harshal-sweplyharshal-sweplysachinpmsachinpmsameerchoudharipmsameerchoudharipmranjeetmahtoranjeetmahtosandeepmahadikqasandeepmahadikqasvmakhanesvmakhaneabdomursal.sallaabdomursal.sallamayuri1712mayuri1712ankita9096ankita9096jaykrushnasweplyjaykrushnasweplysultan-algarbisultan-algarbia-wakodea-wakodef.darzaidf.darzaida.alshomrania.alshomranianhaar-ali-sallaanhaar-ali-sallarohan-sallarohan-sallam.adiom.adiotarekararsallatarekararsallaemadbatwaemadbatwamohannadhanafi-sallamohannadhanafi-sallaabo3ish-sallaabo3ish-sallasalem-bajubairsalem-bajubairm.moharramm.moharramnyadavsweplynyadavsweplymori1999mori1999hinal.dhinal.dshankarsweplyshankarsweplytejasborate11tejasborate11yogeshkhairnaryogeshkhairnary.kumavaty.kumavatvijit123vijit123tejaslendetejaslendem.alsihatim.alsihatim.yasserm.yasseryalturkeyyalturkeymaher-abuyounesmaher-abuyounesbasma159basma159fatiamrouqafatiamrouqa

Readme

@salla.sa/twilight-components-react

React wrapper for Salla Twilight Web Components with full SSR support.

Installation

npm install @salla.sa/twilight-components-react
# or
pnpm add @salla.sa/twilight-components-react

Usage

Client-Side (CSR)

import { SallaButton, SallaModal, SallaAlert } from '@salla.sa/twilight-components-react';

function App() {
  return (
    <div>
      <SallaButton fill="solid" color="primary">
        Click Me
      </SallaButton>
      
      <SallaModal isOpen={false}>
        Modal Content
      </SallaModal>
    </div>
  );
}

Tree-Shaking (Optimized Imports)

The generated components include 'use client' directive for Next.js App Router compatibility. All imports are already optimized for tree-shaking:

// ✅ GOOD: Tree-shaking works automatically
import { SallaButton, SallaModal } from '@salla.sa/twilight-components-react';

// ❌ BAD: Imports everything (avoid this)
import * as Twilight from '@salla.sa/twilight-components-react';

Server-Side Rendering (SSR)

1. Next.js Setup

Option A: Using next/dynamic (Recommended)

// components/SallaButton.tsx
import dynamic from 'next/dynamic';

export const SallaButton = dynamic(
  () => import('@salla.sa/twilight-components-react').then(mod => mod.SallaButton),
  { ssr: false }
);

// Usage
import { SallaButton } from '@/components/SallaButton';

export default function Page() {
  return <SallaButton>Add to Cart</SallaButton>;
}

Option B: Using 'use client' Directive (App Router)

// components/SallaProvider.tsx
'use client';

export { SallaButton, SallaModal, SallaAlert } from '@salla.sa/twilight-components-react';

// app/page.tsx (Server Component)
import { SallaButton } from '@/components/SallaProvider';

export default function Page() {
  return <SallaButton>Server Rendered Button</SallaButton>;
}

Option C: Full Hydration with Stencil Hydrate

// app/layout.tsx or pages/_document.tsx
import { hydrate } from '@salla.sa/twilight-components/hydrate';

// For App Router (layout.tsx)
export default async function RootLayout({ children }) {
  // Hydrate on server
  return (
    <html lang="en">
      <head>
        <script
          dangerouslySetInnerHTML={{
            __html: `
              import('@salla.sa/twilight-components/hydrate').then(m => m.hydrate());
            `
          }}
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

2. Custom SSR Setup

// server.ts
import express from 'express';
import { hydrateToString } from '@salla.sa/twilight-components/hydrate';

const app = express();

app.get('*', async (req, res) => {
  const html = `
    <!DOCTYPE html>
    <html>
      <body>
        <salla-button>Add to Cart</salla-button>
      </body>
    </html>
  `;
  
  // Hydrate on server
  const hydratedHtml = await hydrateToString(html, '/');
  
  res.send(hydratedHtml);
});

3. Vite SSR Setup

// entry-server.ts
import { hydrateToString } from '@salla.sa/twilight-components/hydrate';

export async function render(url: string) {
  const html = `
    <div id="app">
      <salla-button>Click Me</salla-button>
    </div>
  `;
  
  return await hydrateToString(html, url);
}

Full SSR Example with Next.js

Step 1: Create Hydration Provider

// providers/SallaProvider.tsx
'use client';

import { useEffect } from 'react';

export function SallaProvider({ children }: { children: React.ReactNode }) {
  useEffect(() => {
    // Import and hydrate on client
    import('@salla.sa/twilight-components/hydrate').then(({ hydrate }) => {
      hydrate();
    });
  }, []);

  return <>{children}</>;
}

Step 2: Use in Layout

// app/layout.tsx
import { SallaProvider } from '@/providers/SallaProvider';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body>
        <SallaProvider>
          {children}
        </SallaProvider>
      </body>
    </html>
  );
}

Step 3: Use Components

// app/page.tsx
import { SallaButton, SallaProductCard } from '@salla.sa/twilight-components-react';

export default function Home() {
  return (
    <main>
      <SallaButton fill="solid" color="primary">
        Add to Cart
      </SallaButton>
      
      <SallaProductCard 
        product-id="123"
        show-quick-add
      />
    </main>
  );
}

Avoiding Hydration Mismatches

When using SSR with custom elements, wrap components to avoid hydration errors:

// components/SafeSalla.tsx
'use client';

import { useEffect, useState } from 'react';
import { SallaButton } from '@salla.sa/twilight-components-react';

export function SafeSallaButton(props: any) {
  const [mounted, setMounted] = useState(false);

  useEffect(() => {
    setMounted(true);
  }, []);

  if (!mounted) {
    // Return placeholder during SSR
    return <button {...props}>{props.children}</button>;
  }

  return <SallaButton {...props} />;
}

Available Components

All components from @salla.sa/twilight-components are available as React components:

  • SallaButton - Customizable button
  • SallaModal - Modal dialog
  • SallaDrawer - Side drawer
  • SallaAlert - Alert notifications
  • SallaProductCard - Product card display
  • SallaCartSummary - Cart summary
  • SallaComments - Comments section
  • SallaReviews - Product reviews
  • And more...

Bundle Optimization

Recommended: Tree-shaking with Individual Imports

// ✅ Best - Tree-shake unused components
import { SallaButton } from '@salla.sa/twilight-components-react';

Component Groups (Bundles)

These components are bundled together for better caching:

| Bundle | Components | |--------|------------| | UI Core | salla-button, salla-loading, salla-modal, salla-drawer, salla-accordion, salla-breadcrumb | | Forms | salla-file-upload, salla-datetime-picker, salla-color-picker, salla-conditional-fields, salla-tel-input, salla-quantity-input, salla-booking-field | | Comments | salla-comments, salla-comment-form, salla-comment-item, salla-reviews, salla-reviews-page, salla-reviews-summary, salla-rating-stars, salla-review-card | | Product | salla-add-product-button, salla-product-options, salla-product-availability, salla-quick-buy | | Cart | salla-cart-summary, salla-cart-item-offers | | Alerts | salla-alert, salla-bottom-alert |

TypeScript Support

Full TypeScript support is included:

import type { JSX } from '@salla.sa/twilight-components';

interface ButtonProps extends JSX.SallaButton {
  onClick?: () => void;
}

Related Packages

  • @salla.sa/twilight-components - Native web components
  • @salla.sa/twilight-components/hydrate - SSR hydration utilities