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

aed-dirham-symbol

v1.2.0

Published

UAE Dirham currency symbol package for web applications - provides SVG, CSS, and JavaScript implementations with Next.js support

Readme

Dirham Symbol Package 🇦🇪

A comprehensive npm package providing the UAE Dirham (AED) currency symbol for web applications. Includes SVG, CSS, and JavaScript implementations for easy integration.

Installation

npm install aed-dirham-symbol

Usage

1. CSS Implementation (Recommended)

Import the CSS file and use the class:

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="node_modules/dirham-symbol/dirham.css">
</head>
<body>
    Cost <span class="dirham-symbol"></span>12345
</body>
</html>

Or import in your CSS:

@import 'dirham-symbol/dirham.css';

.price::before {
    content: '';
    display: inline-block;
    background-image: url('dirham-symbol/dirham.svg');
    background-size: contain;
    background-repeat: no-repeat;
    width: 0.7em;
    height: 0.7em;
    margin-right: 0.1em;
}

2. JavaScript/React Implementation

import { getDirhamSymbol, DirhamSymbol } from 'dirham-symbol';

// Get SVG as string
const svgString = getDirhamSymbol();
document.getElementById('price').innerHTML = `Cost ${svgString}12345`;

// React component
function Price({ amount }) {
    return (
        <div>
            Cost <DirhamSymbol /> {amount}
        </div>
    );
}

3. Direct SVG Usage

<img src="node_modules/dirham-symbol/dirham.svg" alt="Dirham" style="height: 0.7em; width: auto;">

4. Vue.js Implementation

<template>
  <div>
    Cost <span v-html="dirhamSymbol"></span>{{ amount }}
  </div>
</template>

<script>
import { getDirhamSymbol } from 'dirham-symbol';

export default {
  data() {
    return {
      amount: 12345,
      dirhamSymbol: getDirhamSymbol()
    }
  }
}
</script>

5. Next.js Implementation

App Router (Next.js 13+)

// app/components/PriceDisplay.tsx
'use client';
import { getDirhamSymbol } from 'aed-dirham-symbol';
import 'aed-dirham-symbol/dirham.css';

export default function PriceDisplay({ amount }: { amount: number }) {
  return (
    <div className="price-display">
      Cost <span 
        className="dirham-symbol" 
        dangerouslySetInnerHTML={{ __html: getDirhamSymbol() }}
      /> {amount.toLocaleString()}
    </div>
  );
}

// Usage in app/page.tsx
import PriceDisplay from './components/PriceDisplay';

export default function Home() {
  return (
    <main>
      <PriceDisplay amount={12345} />
    </main>
  );
}

Pages Router (Next.js 12 and below)

// pages/index.tsx
import { getDirhamSymbol } from 'aed-dirham-symbol';
import 'aed-dirham-symbol/dirham.css';

export default function Home() {
  return (
    <div>
      <h1>Price List</h1>
      <p>Cost <span dangerouslySetInnerHTML={{ __html: getDirhamSymbol() }} /> 12,345</p>
    </div>
  );
}

CSS Import in Next.js

// pages/_app.tsx or app/layout.tsx
import 'aed-dirham-symbol/dirham.css';

// Then use the CSS class anywhere
<span>Cost <span className="dirham-symbol"></span> 12,345</span>

Custom Hook for Next.js

// hooks/useDirhamSymbol.ts
import { useEffect, useState } from 'react';
import { getDirhamSymbol } from 'aed-dirham-symbol';

export const useDirhamSymbol = () => {
  const [symbol, setSymbol] = useState('');

  useEffect(() => {
    setSymbol(getDirhamSymbol());
  }, []);

  return symbol;
};

// Usage
export default function PriceComponent({ amount }: { amount: number }) {
  const dirhamSymbol = useDirhamSymbol();
  
  return (
    <span>
      Cost <span dangerouslySetInnerHTML={{ __html: dirhamSymbol }} /> {amount}
    </span>
  );
}

Server-Side Rendering (SSR) Safe

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

const DirhamSymbol = dynamic(
  () => import('aed-dirham-symbol').then(mod => {
    return function DirhamSymbolComponent() {
      return <span dangerouslySetInnerHTML={{ __html: mod.getDirhamSymbol() }} />;
    };
  }),
  { ssr: false }
);

export default function DirhamPrice({ amount }: { amount: number }) {
  return (
    <div>
      Cost <DirhamSymbol /> {amount}
    </div>
  );
}

6. Angular Implementation

import { Component } from '@angular/core';
import { getDirhamSymbol } from 'aed-dirham-symbol';

@Component({
  selector: 'app-price',
  template: `Cost <span [innerHTML]="dirhamSymbol"></span>{{ amount }}`
})
export class PriceComponent {
  amount = 12345;
  dirhamSymbol = getDirhamSymbol();
}

Features

  • ✅ Lightweight and fast
  • ✅ Multiple implementation methods
  • ✅ Framework agnostic
  • ✅ TypeScript support
  • ✅ Responsive design friendly
  • ✅ High-quality SVG symbol
  • ✅ CSS-only solution available
  • ✅ No external dependencies

API Reference

getDirhamSymbol()

Returns the Dirham symbol as an SVG string.

Returns: string - SVG markup for the Dirham symbol

DirhamSymbol (React Component)

A React component that renders the Dirham symbol.

Props: None

Styling

The symbol can be styled like any other inline element:

.dirham-symbol {
    color: #007bff;
    font-size: 1.2em;
    vertical-align: baseline;
}

Browser Support

  • ✅ Chrome (all versions)
  • ✅ Firefox (all versions)
  • ✅ Safari (all versions)
  • ✅ Edge (all versions)
  • ✅ Internet Explorer 11+

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Changelog

v1.0.0

  • Initial release
  • SVG, CSS, and JavaScript implementations
  • TypeScript support
  • Framework examples

Support

If you find this package useful, please consider:

  • ⭐ Starring the repository
  • 🐛 Reporting bugs
  • 💡 Suggesting new features
  • 🤝 Contributing to the code

Made with ❤️ for the UAE developer community