-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Progress Bar Label Becomes Unreadable at Low Values #477
Labels
Comments
This was mentioned in the discord server, I'll leave this open since it's a problem and perhaps we should hide the label or move it outside. Here's a possible workaround that shows the label outside when the value is small: <script lang="ts">
import { Flex, Progress, SvelteUIProvider, Text } from "@svelteuidev/core";
let value = 5;
function increase() {
if (value === 100) {
return;
}
value += 5;
}
function decrease() {
if (value === 0) {
return;
}
value -= 5;
}
$: label = value <= 5 ? '' : `${value}%`;
</script>
<SvelteUIProvider>
<Flex>
<!-- This is necessary since Progress has a position relative, we need
to set the width of the parent -->
<div style="width: 100%">
<Progress bind:value size="lg" {label} />
</div>
{#if value <= 5}
<Text size={12} ml="4">{`${value}%`}</Text>
{/if}
</Flex>
<div style="margin-top: 50px">
<button on:click={increase}>Increase</button>
<button on:click={decrease}>Decrease</button>
</div>
</SvelteUIProvider> Stackblitz with this: https://stackblitz.com/edit/vitejs-vite-6zjfau?file=src%2FApp.svelte |
BeeMargarida
added
enhancement
New feature or request
and removed
bug
Something isn't working
labels
Nov 3, 2023
This is fixed and will be included in an upcoming PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What package has an issue
@svelteuidev/core
A clear and concise description of what the bug is
When the value of a progress bar becomes very low (counting down to zero), the label can become obscured/unreadable.
Suggested fix: when the value becomes low--say 10%--have the label display to the right of the bar in the "vacated" space.
In which browser(s) did the problem occur?
Firefox, Chrome, Safari
Steps To Reproduce
Literally, simply display a progress bar with a value like 5.
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
No
Relevant Assets
No response
The text was updated successfully, but these errors were encountered: