Get Selected Text in React

  Рет қаралды 3,136

Colby Fayock

Colby Fayock

Күн бұрын

Use the Selection API to get selected text in React and show a social media sharing tooltip.
We'll walk through how to use the Selection API to listen for selected text, how to build out a dynamically placed tooltip based on selected text location using Tailwind, and how to share the selected text on click to Twitter.
🧰 Resources
Tutorial: spacejelly.dev...
Code: github.com/col...
Demo: my-highlight-s...
📺 KZbin: kzbin.info...
🐦 Twitter: / colbyfayock
📹 Twitch: / colbyfayock
✉️ Newsletter: www.colbyfayoc...
🎥 What I Use: www.colbyfayoc...
#colbyfayock #reactjs #tailwindcss #webdevelopment

Пікірлер: 28
@colbyfayock
@colbyfayock 6 ай бұрын
Learn how to build a full stack Next.js app in my upcoming course: colbyfayock.com/course
@tobiasjennerjahn8659
@tobiasjennerjahn8659 3 ай бұрын
I *love* this video. The way you talk could not be more perfect. It's quick, but not hectic and it's detailed, but not overwhelmingly so. I don't know how much of that is a deliberate style choice, but whatever you do, please keep doing it. It's refreshingly snappy. I also saw your new Next.js course and that's looking like it is *exactly* what I need. I'm familiar with web dev but have been out of the game for about two years now and all of my professional work was done using Svelte. Finding react resources aimed at someone like me is borderline impossible. This looks like it'll get me up and running in one fell swoop. Amazing.
@colbyfayock
@colbyfayock 3 ай бұрын
really appreciate the kind words. it's absolutely intentional. glad it's been impactful for you!!
@colbyfayock
@colbyfayock Жыл бұрын
Get fresh tutorials and other free content straight to your inbox! colbyfayock.com/news
@blokche_dev
@blokche_dev 11 ай бұрын
Whether you're using React or not, there's still something to learn here. Thanks for sharing!
@colbyfayock
@colbyfayock 11 ай бұрын
no problem!! 🙌
@leonardocitton4627
@leonardocitton4627 Жыл бұрын
Thanks Colby, I needed this video ❤
@leonardocitton4627
@leonardocitton4627 Жыл бұрын
And your coding skills are great!
@colbyfayock
@colbyfayock Жыл бұрын
No problem and thank you!!
@sammed.sankonatti
@sammed.sankonatti 8 ай бұрын
Absolutely brilliant work 👏
@colbyfayock
@colbyfayock 8 ай бұрын
thank you!
@jawyor-k3t
@jawyor-k3t Жыл бұрын
Outstanding as always
@colbyfayock
@colbyfayock Жыл бұрын
Thank you!!
@tiger_chew
@tiger_chew 10 ай бұрын
thanks for sharing , I found it works on desktop browser, but it does not work on the iPhone or Android mobile phone browser , is there a solution for the mobile browser ?
@colbyfayock
@colbyfayock 10 ай бұрын
yeah unfortunately i didnt get a good experience working in mobile. sometime was able to get it to pop up but not consistently. i _think_ i mentioned the caveat in the video, apologies if i forgot to, but also iOS at a minimum has their own popup in-browser, so that would conflict with the UI at least for this example
@sakarvaidya9665
@sakarvaidya9665 5 ай бұрын
I was working on this. But on mobile devices it doesn't work. Mostly because of the touchend event. Any solution?
@colbyfayock
@colbyfayock 5 ай бұрын
unfortunately havent come up with a good solution. part of hte issue is at a minimum iOS devices have their own tooltip prompt that would conflict with this, regardless of how the interaction would work. perhaps instead of a tooltip it could be a drawer fixed to the bottom of the page to avoid that
@yasseraouffen
@yasseraouffen 4 ай бұрын
Thanks a million
@colbyfayock
@colbyfayock 4 ай бұрын
🫶
@Collect-AI
@Collect-AI Жыл бұрын
great video. I'm creating a Chrome extension and would like to add this feature for users to access on any website/page they go on. I've seen it being done with other chrome extensions I use. How can this be implemented in the code?
@colbyfayock
@colbyfayock Жыл бұрын
I'm not familiar with building expenstiins but I would expect you'd set up the event listeners similarly to how I did in the beginning as vanilla JS.
@Collect-AI
@Collect-AI Жыл бұрын
Thank for getting back. So the process you show in the video allows the user to copy text from any webpage they are on?@@colbyfayock
@iplaxtech
@iplaxtech Жыл бұрын
Thanks for sharing, it's very useful :)
@colbyfayock
@colbyfayock Жыл бұрын
No problem!
@MyGeorge1964
@MyGeorge1964 Жыл бұрын
Thank v. much... V. useful bit of code.
@colbyfayock
@colbyfayock Жыл бұрын
No problem 🙌
@scottfwalter
@scottfwalter Жыл бұрын
Please don’t. I find that feature the most annoying part of Medium. I want to just use native copy functionality.
@colbyfayock
@colbyfayock Жыл бұрын
I like it 🤷‍♂️ but it's also not impeding you from doing so either
Pagination in React
29:05
Colby Fayock
Рет қаралды 5 М.
Add to Calendar Button with React & Tailwind
15:06
Colby Fayock
Рет қаралды 3 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Favicons the Right Way
18:07
Colby Fayock
Рет қаралды 12 М.
How a React App Works Under the Hood
14:18
PortEXE
Рет қаралды 59 М.
Learn Shell Scripting With Me Using ChatGPT
47:12
Code With Joel
Рет қаралды 81
Best Way to Add Popup Modals in React
26:19
Colby Fayock
Рет қаралды 12 М.
How to Use Text Fragments to Highlight Searched Text
6:18
Coding in Public
Рет қаралды 2,7 М.
Styling active links in next.js is tricker than you think
10:02
Colby Fayock
Рет қаралды 4,3 М.
Lint & Format JavaScript with Biome
23:20
Colby Fayock
Рет қаралды 7 М.