Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mataku/middleellipsistext
Jetpack Compose Component with ellipsis in the middle of text
https://github.com/mataku/middleellipsistext
jetpack-compose
Last synced: 2 months ago
JSON representation
Jetpack Compose Component with ellipsis in the middle of text
- Host: GitHub
- URL: https://github.com/mataku/middleellipsistext
- Owner: mataku
- License: apache-2.0
- Created: 2022-09-11T11:43:13.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2024-04-14T06:39:00.000Z (9 months ago)
- Last Synced: 2024-04-14T09:59:55.083Z (9 months ago)
- Topics: jetpack-compose
- Language: Kotlin
- Homepage:
- Size: 499 KB
- Stars: 7
- Watchers: 0
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# MiddleEllipsisText
![Maven Central Version](https://img.shields.io/maven-central/v/io.github.mataku/middle-ellipsis-text)
A Text Component with ellipsis in the middle of text for Jetpack Compose and Compose Multiplatform.
If [Text](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Text(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontFamily,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.text.style.TextAlign,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Function1,androidx.compose.ui.text.TextStyle))
comes to support Text-overflow middle cropping, this library will be deprecated.## Requirement
minSdkVersion: 24
## Installation
```kotlin
// settings.gradle(.kts)
pluginManagement {
repositories {
// ...
mavenCentral()
}
}// {module}/build.gradle(.kts)
implementation "io.github.mataku:middle-ellipsis-text:${latestVersion}"// Material 3 Text
// implementation "io.github.mataku:middle-ellipsis-text3:${latestVersion}"```
### Compose Multiplatform
MiddleEllipsisText and MiddleEllipsisText3 support Compose Multiplatform experimentally and only available for iOS, Android and JVM (desktop).
```kotlin
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.mataku:middle-ellipsis-text:${latestVersion}")
}
}
```## Usage
```kotlin
MiddleEllipsisText(
// required
text = "yeah"
)
```The same arguments can be specified as
for [Text](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Text(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontFamily,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.text.style.TextAlign,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Function1,androidx.compose.ui.text.TextStyle))
composable. See more
details: https://github.com/mataku/MiddleEllipsisText/blob/develop/MiddleEllipsisText/src/main/java/io/github/mataku/middleellipsistext/MiddleEllipsisText.kt## Screenshot
| iOS | Android | Desktop |
| :--: | :--: | :--: |
| | | |