{"id":14460137,"url":"https://github.com/MohamedRejeb/compose-rich-editor","last_synced_at":"2025-08-28T18:31:52.030Z","repository":{"id":158809884,"uuid":"630584174","full_name":"MohamedRejeb/compose-rich-editor","owner":"MohamedRejeb","description":"A Rich text editor library for both Jetpack Compose and Compose Multiplatform, fully customizable, supports HTML and Markdown.","archived":false,"fork":false,"pushed_at":"2024-12-13T11:06:09.000Z","size":5534,"stargazers_count":1197,"open_issues_count":70,"forks_count":80,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-12-13T12:19:24.125Z","etag":null,"topics":["android","android-library","compose","compose-android","compose-desktop","compose-ios","compose-library","compose-multiplatform","compose-multiplatform-library","compose-ui","compose-web","kmp","kmp-library","kotlin","kotlin-android","kotlin-multiplatform","rich-text","rich-text-editor","richtext","richtexteditor"],"latest_commit_sha":null,"homepage":"https://mohamedrejeb.github.io/compose-rich-editor/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MohamedRejeb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://www.buymeacoffee.com/mohamedrejeb"]}},"created_at":"2023-04-20T17:37:44.000Z","updated_at":"2024-12-13T11:05:39.000Z","dependencies_parsed_at":"2023-11-17T20:01:38.005Z","dependency_job_id":"de50c383-035b-4c73-9aca-c91a31406d2e","html_url":"https://github.com/MohamedRejeb/compose-rich-editor","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohamedRejeb%2Fcompose-rich-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohamedRejeb%2Fcompose-rich-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohamedRejeb%2Fcompose-rich-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohamedRejeb%2Fcompose-rich-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MohamedRejeb","download_url":"https://codeload.github.com/MohamedRejeb/compose-rich-editor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231294144,"owners_count":18354140,"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":["android","android-library","compose","compose-android","compose-desktop","compose-ios","compose-library","compose-multiplatform","compose-multiplatform-library","compose-ui","compose-web","kmp","kmp-library","kotlin","kotlin-android","kotlin-multiplatform","rich-text","rich-text-editor","richtext","richtexteditor"],"created_at":"2024-09-01T21:01:04.893Z","updated_at":"2025-08-28T18:31:52.009Z","avatar_url":"https://github.com/MohamedRejeb.png","language":"Kotlin","funding_links":["https://www.buymeacoffee.com/mohamedrejeb","https://www.buymeacoffee.com/MohamedRejeb","https://img.buymeacoffee.com/button-api/?text=Buy"],"categories":["Kotlin"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCompose Rich Editor\u003c/h1\u003e\u003cbr\u003e\n\n[![Kotlin](https://img.shields.io/badge/kotlin-2.1.10-blue.svg?logo=kotlin)](http://kotlinlang.org)\n[![Compose](https://img.shields.io/badge/compose-1.7.3-blue.svg?logo=jetpackcompose)](https://www.jetbrains.com/lp/compose-multiplatform)\n[![MohamedRejeb](https://raw.githubusercontent.com/MohamedRejeb/MohamedRejeb/main/badges/mohamedrejeb.svg)](https://github.com/MohamedRejeb)\n[![Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)\n[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)\n[![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.richeditor/richeditor-compose/1.0.0-rc13)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.richeditor%22%20AND%20a:%22richeditor-compose%22)\n\n![Compose Rich Editor](docs/images/logo-large-light.svg#gh-light-mode-only)\n![Compose Rich Editor](docs/images/logo-large-dark.svg#gh-dark-mode-only)\n\nA rich text editor library for both Jetpack Compose and Compose Multiplatform, fully customizable and supports the common rich text editor features\n\n- **Multiplatform**: Compose Rich Editor supports Compose Multiplatform (Android, iOS, Desktop, Web).\n- **Easy to use**: Compose Rich Editor's API leverages Kotlin's language features for simplicity and minimal boilerplate.\n- **WYSIWYG**: Compose Rich Editor is a WYSIWYG editor that supports the most common text styling features.\n\n## Screenshots\n\n### Slack Demo\n![Slack Demo](docs/images/screenshot-01.png)\n\n### Html to Rich Text\n![Slack Demo](docs/images/screenshot-02.png)\n\n### Markdown to Rich Text\n![Slack Demo](docs/images/screenshot-03.png)\n\n## Download\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.richeditor/richeditor-compose/1.0.0-rc13)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.richeditor%22%20AND%20a:%22richeditor-compose%22)\n\nCompose Rich Editor is available on `mavenCentral()`.\n\n```kotlin\nimplementation(\"com.mohamedrejeb.richeditor:richeditor-compose:1.0.0-rc13\")\n```\n\n## Compatibility\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.richeditor/richeditor-compose/1.0.0-rc13)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.richeditor%22%20AND%20a:%22richeditor-compose%22)\n\n| Kotlin version | Compose version | Compose Rich Editor version |\n|----------------|-----------------|-----------------------------|\n| 2.1.21         | 1.8.2           | 1.0.0-rc13                  |\n| 2.1.10         | 1.7.3           | 1.0.0-rc11                  |\n| 2.0.21         | 1.7.0           | 1.0.0-rc10                  |\n| 2.0.20         | 1.6.11          | 1.0.0-rc09                  |\n| 2.0.10         | 1.6.11          | 1.0.0-rc06                  |\n| 2.0.0          | 1.6.10          | 1.0.0-rc05-k2               |\n| 1.9.24         | 1.6.10          | 1.0.0-rc05                  |\n\n## Quick Start\n\n#### RichTextState\n\nUse `RichTextEditor` composable to create a rich text editor.\n\nThe `RichTextEditor` composable requires a `RichTextState` to manage the editor's state.\n\nTo create a `RichTextState`, use the `rememberRichTextState` function:\n\n```kotlin\nval state = rememberRichTextState()\n\nRichTextEditor(\n    state = state,\n)\n```\n\n#### Styling Spans\n\nTo style spans, `RichTextState` provides `toggleSpanStyle` method:\n\n```kotlin\n// Toggle a span style.\nrichTextState.toggleSpanStyle(SpanStyle(fontWeight = FontWeight.Bold))\n```\n\nTo get the current span style of the selection, use `RichTextState.currentSpanStyle`:\n\n```kotlin\n// Get the current span style.\nval currentSpanStyle = richTextState.currentSpanStyle\nval isBold = currentSpanStyle.fontWeight == FontWeight.Bold\n```\n\n#### Styling Paragraphs\n\nTo style paragraphs, `RichTextState` provides `toggleParagraphStyle` method:\n\n```kotlin\n// Toggle a paragraph style.\nrichTextState.toggleParagraphStyle(ParagraphStyle(textAlign = TextAlign.Center))\n```\n\nTo get the current paragraph style of the selection, use `RichTextState.currentParagraphStyle`:\n\n```kotlin\n// Get the current paragraph style.\nval currentParagraphStyle = richTextState.currentParagraphStyle\nval isCentered = currentParagraphStyle.textAlign == TextAlign.Center\n```\n\n#### Add links\n\nTo add links, `RichTextState` provides `addLink` method:\n\n```kotlin\n// Add link after selection.\nrichTextState.addLink(\n    text = \"Compose Rich Editor\",\n    url = \"https://github.com/MohamedRejeb/Compose-Rich-Editor\"\n)\n```\n\nTo get if the current selection is a link, use `RichTextState.isLink`:\n\n```kotlin\n// Get if the current selection is a link.\nval isLink = richTextState.isLink\n```\n\nBy default, links will be opened by your platform's `UriHandler`, if however you want to\nhandle the links on your own, you can override the composition local as such:\n\n```kotlin\nval myUriHandler by remember {\n    mutableStateOf(object : UriHandler {\n        override fun openUri(uri: String) {\n            // Handle the clicked link however you want\n        }\n    })\n}\nCompositionLocalProvider(LocalUriHandler provides myUriHandler) {\n    RichText(\n        state = richTextState,\n        modifier = Modifier.fillMaxWidth()\n    )\n}\n```\n\n#### Add Code Blocks\n\nTo add code blocks, `RichTextState` provides `toggleCodeSpan` method:\n\n```kotlin\n// Toggle code span.\nrichTextState.toggleCodeSpan()\n```\n\nTo get if the current selection is a code block, use `RichTextState.isCodeSpan`:\n\n```kotlin\n// Get if the current selection is a code span.\nval isCodeSpan = richTextState.isCodeSpan\n```\n\n#### Ordered and Unordered Lists\n\nYou can add ordered and unordered lists using `RichTextState`:\n\n```kotlin\n// Toggle ordered list.\nrichTextState.toggleOrderedList()\n\n// Toggle unordered list.\nrichTextState.toggleUnorderedList()\n```\n\nYou can get if the current selection is an ordered or unordered list, using `RichTextState`:\n\n```kotlin\n// Get if the current selection is an ordered list.\nval isOrderedList = richTextState.isOrderedList\n\n// Get if the current selection is an unordered list.\nval isUnorderedList = richTextState.isUnorderedList\n```\n\n#### Customizing the rich text configuration\n\nSome of the rich text editor's features can be customized, such as the color of the links and the code blocks.\n\n```kotlin\nrichTextState.config.linkColor = Color.Blue\nrichTextState.config.linkTextDecoration = TextDecoration.Underline\nrichTextState.config.codeSpanColor = Color.Yellow\nrichTextState.config.codeSpanBackgroundColor = Color.Transparent\nrichTextState.config.codeSpanStrokeColor = Color.LightGray\n```\n\n#### HTML import and export\n\nTo convert HTML to `RichTextState`, use `RichTextState.setHtml` method:\n\n```kotlin\nval html = \"\u003cp\u003e\u003cb\u003eCompose Rich Editor\u003c/b\u003e\u003c/p\u003e\"\nrichTextState.setHtml(html)\n```\n\nTo insert HTML content at a specific position, use `RichTextState.insertHtml` method:\n\n```kotlin\nval html = \"\u003cb\u003einserted content\u003c/b\u003e\"\nrichTextState.insertHtml(html, position = 5)\n```\n\nTo convert `RichTextState` to HTML, use `RichTextState.toHtml` method:\n\n```kotlin\nval html = richTextState.toHtml()\n```\n\n#### Markdown import and export\n\nTo convert Markdown to `RichTextState`, use `RichTextState.setMarkdown` method:\n\n```kotlin\nval markdown = \"**Compose** *Rich* Editor\"\nrichTextState.setMarkdown(markdown)\n```\n\nTo insert Markdown content at a specific position, use `RichTextState.insertMarkdown` method:\n\n```kotlin\nval markdown = \"**inserted** *content*\"\nrichTextState.insertMarkdown(markdown, position = 5)\n```\n\nTo convert `RichTextState` to Markdown, use `RichTextState.toMarkdown` method:\n\n```kotlin\nval markdown = richTextState.toMarkdown()\n```\n\nCheck out Compose Rich Editor's [full documentation](https://mohamedrejeb.github.io/compose-rich-editor/) for more details.\n\n## Web live demo\nYou can try out the web demo [here](https://compose-richeditor.netlify.app/).\n\n## Contribution\nIf you've found an error in this sample, please file an issue. \u003cbr\u003e\nFeel free to help out by sending a pull request :heart:.\n\n[Code of Conduct](https://github.com/MohamedRejeb/Compose-Rich-Editor/blob/main/CODE_OF_CONDUCT.md)\n\n## Find this library useful? :heart:\nSupport it by joining __[stargazers](https://github.com/MohamedRejeb/Compose-Rich-Editor/stargazers)__ for this repository. :star: \u003cbr\u003e\nAlso, __[follow me](https://github.com/MohamedRejeb)__ on GitHub for more libraries! 🤩\n\nYou can always \u003ca href=\"https://www.buymeacoffee.com/MohamedRejeb\" target=\"_blank\"\u003e\u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee\u0026emoji=\u0026slug=MohamedRejeb\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Cookie\u0026outline_colour=000000\u0026coffee_colour=ffffff\"\u003e\u003c/a\u003e\n\n# License\n```markdown\nCopyright 2023 Mohamed Rejeb\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMohamedRejeb%2Fcompose-rich-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMohamedRejeb%2Fcompose-rich-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMohamedRejeb%2Fcompose-rich-editor/lists"}