Closed Ghoral closed 1 year ago
Hi @Ghoral, you can add the focus-visible:ring-0
classname to the <Input>
component. This will disable the focus ring just for a single instance.
If you want to remove it from all Input
you can remove all the classnames that start with focus-visible:
in the input.tsx
file.
Thank you for quick response.
focus-visible:ring-transparent
works better for me.
focus-visible:ring-transparent
works better for me.
same solution as u 🍭
Neither focus-visible:ring-0
nor focus-visible:ring-transparent
seem to be working for me. Anyone else?
<Input type="email" className="bg-transparent border-0 border-b-2 border-gray-500 px-6 py-8 focus-visible:ring-offset-0 focus-visible:ring-0" placeholder="Email" />
do this
You can remove the classname: focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 from input component provided by the shadn in components/ui/input.jsx.
<input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props} />
i am directly changing from the component provided by shadcn to preserve the consistency in your project.
this works for me
focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0
focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0
thank you ! it works!!!!!!
how do we do this in select component. Tried many things but none is working ;(
how do we do this in select component. Tried many things but none is working ;(
Just use "focus:" instead of "focus-visible", like this:
<Select>
<SelectTrigger className="w-[180px] focus:ring-offset-0 focus:ring-0">
<SelectValue placeholder="Select a fruit" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>Fruits</SelectLabel>
<SelectItem value="apple">Apple</SelectItem>
<SelectItem value="banana">Banana</SelectItem>
<SelectItem value="blueberry">Blueberry</SelectItem>
<SelectItem value="grapes">Grapes</SelectItem>
<SelectItem value="pineapple">Pineapple</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
You can also verify what properties your component uses opening the file that shadcnui creates (like select.tsx).
I tried it but the ring is visible yet when the select trigger is closed.
focus-visible:ring-[none] worked for me
tabindex=-1
Hi, How can I remove the outline in input when focused?
Thank you.