Here is a little 8 pin IC that has the two MOSFETs inside.
Soc. frequency is 850khz so the inductor is small.
If the current gets too high there is two ways the current is under controle. Loop one responds in a couple of nano-seconds and the second in mili-seconds.
If you want to limit the brightness you connect your computer to the "INH" pin. PWM that pin at 100 to 1000hz. I use a small 8 or 6 pin u-computer to do that and it also watches buttons and conditions. Often the micro computer also watch the LED's temperature.
View attachment 121064
I have not used this part, I have used parts like this to make the entire PCB and LED fit inside a light bulb. (flash light bulb)