{"id":19658367,"url":"https://github.com/danktuary/react-discord-message","last_synced_at":"2025-07-14T17:10:10.362Z","repository":{"id":36205758,"uuid":"176175979","full_name":"Danktuary/react-discord-message","owner":"Danktuary","description":"React components to easily build and display fake Discord messages on your webpages.","archived":false,"fork":false,"pushed_at":"2022-12-10T16:58:17.000Z","size":1784,"stargazers_count":34,"open_issues_count":30,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-23T12:17:38.833Z","etag":null,"topics":["discord","react","react-components"],"latest_commit_sha":null,"homepage":"https://react-discord-message.netlify.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Danktuary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-18T00:08:25.000Z","updated_at":"2024-09-10T08:50:31.000Z","dependencies_parsed_at":"2023-01-16T23:46:17.922Z","dependency_job_id":null,"html_url":"https://github.com/Danktuary/react-discord-message","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danktuary%2Freact-discord-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danktuary%2Freact-discord-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danktuary%2Freact-discord-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danktuary%2Freact-discord-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Danktuary","download_url":"https://codeload.github.com/Danktuary/react-discord-message/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224130066,"owners_count":17260747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","react","react-components"],"created_at":"2024-11-11T15:37:21.783Z","updated_at":"2024-11-11T15:37:22.769Z","avatar_url":"https://github.com/Danktuary.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Discord Message\n\nReact components to easily build and display fake Discord messages on your webpages.\n\nIf you use Vue in your project, you should use [vue-discord-message](https://vue-discord-message.netlify.com/).\nIf you want to use web components instead, use [wc-discord-message](https://github.com/Danktuary/wc-discord-message)!\n\n```sh\nyarn add @danktuary/react-discord-message\n# or npm install @danktuary/react-discord-message\n# browser build also available: https://unpkg.com/@danktuary/react-discord-message\n```\n\n![react-discord-message preview](https://i.imgur.com/XX0JUdt.png)\n\n```jsx\nimport React from 'react';\nimport { DiscordMention, DiscordMessage, DiscordMessages } from '@danktuary/react-discord-message';\n\nexport default function App() {\n\treturn (\n\t\t\u003cDiscordMessages\u003e\n\t\t\t\u003cDiscordMessage\u003e\n\t\t\t\tHey guys, I'm new here! Glad to be able to join you all!\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"Dawn\" avatar=\"red\"\u003e\n\t\t\t\tHi, I'm new here too!\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"Sanctuary\" avatar=\"https://i.imgur.com/0TeacfY.png\" roleColor=\"#0099ff\"\u003e\n\t\t\t\tHey, \u003cDiscordMention /\u003e and \u003cDiscordMention\u003eDawn\u003c/DiscordMention\u003e. Welcome to our server!\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"Twelve\" avatar=\"https://i.imgur.com/Mc0F0Hf.png\" roleColor=\"#15b153\"\u003e\n\t\t\t\tHello everyone! How's it going?\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"User\"\u003e\n\t\t\t\tThank you \u003cDiscordMention highlight={true}\u003eSanctuary\u003c/DiscordMention\u003e!\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"Yotsuba\" avatar=\"https://i.imgur.com/amw0MGJ.png\"\u003e\n\t\t\t\tI'm doing well, \u003cDiscordMention\u003eTwelve\u003c/DiscordMention\u003e. What about yourself?\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"Twelve\" avatar=\"https://i.imgur.com/Mc0F0Hf.png\" roleColor=\"#15b153\"\u003e\n\t\t\t\t!8ball How am I doing today?\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage bot={true} author=\"Rinon\" avatar=\"https://i.imgur.com/axQ9wJl.png\" roleColor=\"violet\"\u003e\n\t\t\t\tYes.\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\u003c/DiscordMessages\u003e\n\t)\n}\n```\n\n## Features\n\n* Design modeled after [Discord](https://discord.com/) itself\n* Comfy and compact mode support\n* Dark and light themes support\n* Set the message author's username, avatar (use defaults or provide your own), role color, and \"bot\" tag status\n* Display fake user, role, and channel mentions\n* Complete embed support\n* Simple syntax!\n\n## Installation\n\n### Package managers\n\nIf you're using a package manager, you can install it like normal.\n\n```bash\nyarn add @danktuary/react-discord-message\n# or npm install @danktuary/react-discord-message\n```\n\nImport it and then use the components in your JSX.\n\n```jsx\nimport React from 'react'\nimport { DiscordMessage, DiscordMessages } from '@danktuary/react-discord-message'\n\nexport default function App() {\n\treturn (\n\t\t\u003cDiscordMessages\u003e\n\t\t\t\u003cDiscordMessage\u003e\n\t\t\t\tHey guys, I'm new here! Glad to be able to join you all!\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessage author=\"Dawn\" avatar=\"red\"\u003e\n\t\t\t\tHi, I'm new here too!\n\t\t\t\u003c/DiscordMessage\u003e\n\t\t\u003c/DiscordMessages\u003e\n\t)\n}\n```\n\n### Browser build\n\nIf you want to use the browser build, you can pull it in via unpkg, along with the other necessary files.\n\n```html\n\u003cbody\u003e\n\t\u003cdiv id=\"root\"\u003e\u003c/div\u003e\n\t\u003cscript crossorigin src=\"https://unpkg.com/react@17/umd/react.development.js\"\u003e\u003c/script\u003e\n\t\u003cscript crossorigin src=\"https://unpkg.com/react-dom@17/umd/react-dom.development.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"https://unpkg.com/@babel/standalone/babel.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"https://unpkg.com/@danktuary/react-discord-message@^1.0.0/dist/index.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript type=\"text/babel\"\u003e\n\t\tconst { DiscordMessage, DiscordMessages } = ReactDiscordMessage\n\n\t\tReactDOM.render((\n\t\t\t\u003cDiscordMessages\u003e\n\t\t\t\t\u003cDiscordMessage\u003e\n\t\t\t\t\tHey guys, I'm new here! Glad to be able to join you all!\n\t\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\t\u003cDiscordMessage author=\"Dawn\" avatar=\"red\"\u003e\n\t\t\t\t\tHi, I'm new here too!\n\t\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003cDiscordMessages\u003e\n\t\t), document.getElementById('root'))\n\t\u003c/script\u003e\n\u003c/body\u003e\n```\n\nDo note that using a package manager is recommended.\n\n## Usage\n\nThe syntax is kept fairly simple. Here's a basic example of a regular conversation:\n\n```jsx\n\u003cDiscordMessages\u003e\n\t\u003cDiscordMessage\u003e\n\t\tHey guys, I'm new here! Glad to be able to join you all!\n\t\u003c/DiscordMessage\u003e\n\t\u003cDiscordMessage author=\"Dawn\" avatar=\"red\"\u003e\n\t\tHi, I'm new here too!\n\t\u003c/DiscordMessage\u003e\n\t\u003cDiscordMessage author=\"Sanctuary\" avatar=\"https://i.imgur.com/0TeacfY.png\" roleColor=\"#0099ff\"\u003e\n\t\tHey, \u003cDiscordMention /\u003e and \u003cDiscordMention\u003eDawn\u003c/DiscordMention\u003e. Welcome to our server!\n\t\u003c/DiscordMessage\u003e\n\u003c/DiscordMessages\u003e\n```\n\n### Context options\n\nAfter installation, you can use the `\u003cDiscordOptionsContext\u003e` component to configure the plugin to your liking through the following settings.\n\n```jsx\nimport React from 'react'\nimport {\n\tDiscordDefaultOptions\n\tDiscordMessage,\n\tDiscordMessages,\n\tDiscordOptionsContext,\n} from '@danktuary/react-discord-message'\n\n// Extend the default options in order to provide your own\nconst discordOptions = {\n\t...DiscordDefaultOptions,\n\t// ...\n}\n\nexport default function App() {\n\treturn (\n\t\t\u003cDiscordOptionsContext.Provider value={discordOptions}\u003e\n\t\t\t\u003cDiscordMessages\u003e\n\t\t\t\t\u003cDiscordMessage\u003e...\u003c/DiscordMessage\u003e\n\t\t\t\u003c/DiscordMessages\u003e\n\t\t\t\u003cDiscordMessages\u003e\n\t\t\t\t\u003cDiscordMessage\u003e...\u003c/DiscordMessage\u003e\n\t\t\t\u003c/DiscordMessages\u003e\n\t\t\u003c/DiscordOptionsContext.Provider\u003e\n\t)\n}\n```\n\n#### Default font\n\nBy default, this package uses the Google Fonts CDN to pull in the Roboto font. This isn't the same font Discord uses, so if you want to provide your own, you can override the CSS.\n\n```css\n/* index.css */\n.discord-messages {\n\tfont-family: 'Your Font', sans-serif;\n}\n```\n\n#### Avatar shortcuts\n\nThe current avatar shortcut strings available are \"blue\" (default), \"gray\", \"green\", \"orange\", and \"red\". These shortcuts map to the following image links:\n\n```json\n{\n\t\"blue\": \"https://cdn.discordapp.com/attachments/654503812593090602/665721745466195978/blue.png\",\n\t\"gray\": \"https://cdn.discordapp.com/attachments/654503812593090602/665721746569166849/gray.png\",\n\t\"green\": \"https://cdn.discordapp.com/attachments/654503812593090602/665721748431306753/green.png\",\n\t\"orange\": \"https://cdn.discordapp.com/attachments/654503812593090602/665721750201434138/orange.png\",\n\t\"red\": \"https://cdn.discordapp.com/attachments/654503812593090602/665721752277483540/red.png\"\n}\n```\n\nIf you want to add to or override the shortcuts, you can set them via the `avatars` property.\n\n```js\nconst discordOptions = {\n\t...DiscordDefaultOptions,\n\tavatars: {\n\t\t...DiscordDefaultOptions.avatars,\n\t\t'default': DiscordDefaultOptions.avatars.green,\n\t\tjojo: 'https://i.imgur.com/BOlehTj.jpg',\n\t},\n}\n```\n\n#### Profile shortcuts\n\nSometimes you'll want to use the same message data across multiple messages. You can do so by providing an object of profiles.\n\n```js\nconst discordOptions = {\n\t...DiscordDefaultOptions,\n\tprofiles: {\n\t\tsanc: {\n\t\t\tauthor: 'Sanctuary',\n\t\t\tavatar: 'https://i.imgur.com/0TeacfY.png',\n\t\t},\n\t\trinon: {\n\t\t\tauthor: 'Rinon',\n\t\t\tavatar: 'https://i.imgur.com/axQ9wJl.png',\n\t\t\tbot: true,\n\t\t\troleColor: '#ee82ee',\n\t\t},\n\t},\n}\n```\n\nAnd then in your JSX:\n\n```jsx\nexport default function App() {\n\treturn (\n\t\t\u003cDiscordOptionsContext.Provider value={discordOptions}\u003e\n\t\t\t\u003cDiscordMessages\u003e\n\t\t\t\t\u003cDiscordMessage profile=\"rinon\"\u003e\n\t\t\t\t\tWelcome to our server, \u003cDiscordMention profile=\"sanc\" /\u003e!\n\t\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\t\u003cDiscordMessage profile=\"sanc\"\u003e\n\t\t\t\t\tHey, glad to be here!\n\t\t\t\t\u003c/DiscordMessage\u003e\n\t\t\t\u003c/DiscordMessages\u003e\n\t\t\u003c/DiscordOptionsContext.Provider\u003e\n\t)\n}\n```\n\n### Components notes\n\nBelow are notes for a few certain components. If you want to see what props each component has, check the `propTypes` property within in the respective components inside the [`/src/components/`](https://github.com/Danktuary/react-discord-message/blob/master/src/components/) folder.\n\n#### DiscordMessages component\n\nThis is a wrapper for any child `\u003cDiscordMessage\u003e` component. It must be used in order for messages to display properly.\n\n#### DiscordMention component\n\nIf the default slot is left empty, the mention will be rendered as `'User'`, `'Role'`, or `'channel`', depending on the `type` prop given.\n\n#### DiscordEmbed component\n\nAn embed that can be attached to the end of your messages. The default slot is used for the embed's description. The `footer` slot is used for the footer text.\n\nTo ensure the embed gets displayed correctly inside your message, be sure to give it the proper `slot` attribute.\n\n```jsx\n\u003cDiscordMessage\u003e\n\tHi, I'm part of the normal message content.\n\t\u003cDiscordEmbed slot=\"embeds\" color=\"#0099ff\"\u003e\n\t\tHi, I'm part of the embed message content.\n\t\u003c/DiscordEmbed\u003e\n\u003c/DiscordMessage\u003e\n```\n\n#### EmbedFields component\n\nA wrapper for any child `\u003cDiscordEmbedField\u003e` components. Must be used in order for fields to display properly. To ensure the embed fields gets displayed correctly inside your embed, be sure to give it the proper `slot` attribute.\n\n```jsx\n\u003cDiscordMessage\u003e\n\t\u003cDiscordEmbed slot=\"embeds\"\u003e\n\t\tHi, I'm part of the embed message content.\n\t\t\u003cDiscordEmbedFields slot=\"fields\"\u003e\n\t\t\t{/* Embed fields go here */}\n\t\t\u003c/DiscordEmbedFields\u003e\n\t\u003c/DiscordEmbed\u003e\n\u003c/DiscordMessage\u003e\n```\n\n#### EmbedField component\n\nAt least 2 consecutive fields need to be marked as inline in order for them to actually display next to each other. The maximum amount of inline fields is 3.\n\n```jsx\n\u003cDiscordMessage\u003e\n\t\u003cDiscordEmbed slot=\"embeds\"\u003e\n\t\tHi, I'm part of the embed message content.\n\t\t\u003cDiscordEmbedFields slot=\"fields\"\u003e\n\t\t\t\u003cDiscordEmbedField fieldTitle=\"Inline field\" inline={true}\u003e\n\t\t\t\tField content.\n\t\t\t\u003c/DiscordEmbedField\u003e\n\t\t\t\u003cDiscordEmbedField fieldTitle=\"Inline field\" inline={true}\u003e\n\t\t\t\tField content.\n\t\t\t\u003c/DiscordEmbedField\u003e\n\t\t\u003c/DiscordEmbedFields\u003e\n\t\u003c/DiscordEmbed\u003e\n\u003c/DiscordMessage\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanktuary%2Freact-discord-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanktuary%2Freact-discord-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanktuary%2Freact-discord-message/lists"}